maevemcg88
asked on
Excel Formula that factors in dates in calculating revenue
I need a Microsoft Excel formula that will help me calculate revenue based on a date. For example, I will have a date, say 5/21/2010, and I need to account for all days following this date until the end of the year (so, from 5/21 to 12/31) -- need to get a total count of days, like 180.
Need a date formula that will calculate this.
Need a date formula that will calculate this.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
All you should have to do is to subtract the cell where the first date is from the cell where the second one is and change the format of the cell where the formula is to a number.
Or just use:
=B1-A1
and format the result as a number
=B1-A1
and format the result as a number
xover...
="mm/dd/yy"-now() so for your formula will be ="12/31/10"-now()
But 5/21/2010 is not now!!
If you have a date in A1 this will count the number of days until the end of that year.....including that date
=DATE(YEAR(A1)+1,1,1)-A1
format result cell as general
regards, barry
=DATE(YEAR(A1)+1,1,1)-A1
format result cell as general
regards, barry
=DATEDIF(A1,B1,"d")*C1
A1 is start date, B1 is end date, C1 is revenue
Very similar to Patrick's, so if you do like this answer, give the points to him. :)
A1 is start date, B1 is end date, C1 is revenue
Very similar to Patrick's, so if you do like this answer, give the points to him. :)
ASKER
I don't have to columns with dates -- its just the end of the year, so I guess it would be 12/31. Should I make a column that is 12/31 and then use the formula =DATEDIF(A1,B1,"d")?
You can just put the value there:
DATEDIF(A1,"12/31/10","d")
I'm assuming your regional date setting are mm/dd, and not dd/mm
DATEDIF(A1,"12/31/10","d")
I'm assuming your regional date setting are mm/dd, and not dd/mm
If you use the formula I suggested above then you can get the result you need (number of days until the end of the year) with just a single date, i.e. with date in A1
=DATE(YEAR(A1)+1,1,1)-A1
format result cell as general
regards, barry
=DATE(YEAR(A1)+1,1,1)-A1
format result cell as general
regards, barry
....note, if the date in A1 is 30th December (of any year) then the formula O suggested will give a result of 2 (because it counts the 30th and 31st). Of you want a result of 1 for that example then change formula slightly as follows:
=DATE(YEAR(A1),1,0)-A1
Either formule will give you the number of days until the end of that year, irrespective of the year of the date
Regards, barry
=DATE(YEAR(A1),1,0)-A1
Either formule will give you the number of days until the end of that year, irrespective of the year of the date
Regards, barry
ASKER
Great, the formula worked. Thank you all.
My next question is... once I have this value how do I subtract it from a YEAR. I tried subtracting it simply from 365 but is there any more accurate way to subtract a number of days from a year? Simple question, appreciate any answer. THANKS.
My next question is... once I have this value how do I subtract it from a YEAR. I tried subtracting it simply from 365 but is there any more accurate way to subtract a number of days from a year? Simple question, appreciate any answer. THANKS.
You can still use:
=DATEDIF(01/01/2010,31/12/ 2010,"d") to find out the number of days in the year
or you could use:
=If(int(year(date)/4)=year (date), 366, 365)
for leap years and non-leap years
Patrick
=DATEDIF(01/01/2010,31/12/
or you could use:
=If(int(year(date)/4)=year
for leap years and non-leap years
Patrick
Wouldn't subtracting the number of days left in the year from the number of days in the year be the same as counting from the start of the year to your date?
For that try
=A1-DATE(YEAR(A1),1,1)
That will be the equivalent of subtracting the previous result from 365.....or 366 if the year is a leap year
regards, barry
For that try
=A1-DATE(YEAR(A1),1,1)
That will be the equivalent of subtracting the previous result from 365.....or 366 if the year is a leap year
regards, barry