# Excel 2007 : Subtract date from a current date and show difference in months and days

1. ## Subtract date from a current date and show difference in months and days

Ok...to give scenario

I need to subtract date of report from current date to work out how old the report is.

So Column A is date of report and I need to have a number of months (report age) in column B

I need to do this for multiple cells i.e. column A will have close to 200 dates

In other words...when I enter the date of report in column A I would like to have the number in column B that shows how long since the report was generated

So that's first part of the problem

Also, is it possible then to, based on the value in Column B to have like Column C which will have another value that will be calculated based on age of report

i.e. if report is more than 30 days old the value of 5 is automatically populated in column C

something like

if >1 then = 5
if >2 then = 10
if >3 then = 15

1,2,3 referring to number of months and values 5,10, 15 referring to auto populated column C

As in first case, I need solution for multiple entries  Register To Reply

2. ## Re: Subtract date from a current date and show difference in months and days

Ron,

Assuming your dates start in A1, paste the first formula in cell B1 and the second formula in C1 then copy and paste the formulas down column B & C.
There are probably better ways to do this. ``Please Login or Register  to view this content.``  Register To Reply

3. ## Re: Subtract date from a current date and show difference in months and days

The first line '=IF(A1="","",(NOW()-A1)/30)' works okay but how do I get it to work for all Cells in A column ?

Copying/pasting replicates the same calculation i.e. only taking into account A1 cell and current date

It does not change to corresponding cell i.e. A2, A3, A4....  Register To Reply

4. ## Re: Subtract date from a current date and show difference in months and days

Once the formulas are working in cells B1 and C1, select those 2 cells, copy then select all of the cells where you want the formulas, then paste.
This should work.  Register To Reply

5. ## Re: Subtract date from a current date and show difference in months and days

I added the solution off ncmay in a workbook and added another solution.

See the golden cells.

With Vlookup in a table.

Do you have questions, just ask.  Register To Reply

6. ## Re: Subtract date from a current date and show difference in months and days

Thank you so much for that

I now get calculations ok but in an odd format (see attachment)

How do I get it to show in Months i.e.. 3.4,4.0, 5.5 etc  Register To Reply

7. ## Re: Subtract date from a current date and show difference in months and days

Change the format.

Right mouse click => format => General

Would that help?  Register To Reply

8. ## Re: Subtract date from a current date and show difference in months and days

Brilliant ! Thanks so much...

I have a lot to learn, but I'm getting there Thanks so much

I'll now keep going and post other problems if I hit the bump   Register To Reply

9. ## Re: Subtract date from a current date and show difference in months and days

If the question is solved, will you mark your question as solved?

If you got other questions, concerning Excel  , just ask.  Register To Reply

10. ## Re: Subtract date from a current date and show difference in months and days

=DATEDIF(A1,TODAY(),"m") gives months =DATEDIF(A1,TODAY(),"md") gives remaining days so today 24/6/12 from 14/2/12 returns 4 and 9 respectively  Register To Reply

11. ## Re: Subtract date from a current date and show difference in months and days

how do i assign the value to numbers in column B so it is automatically show in column E?

so the values in column B are the result of calculation (current date - date of report = number in months)

in other words....for example if number in column B is 5 the value in the column E should automatically populate as 10

the score in E column will contribute towards total score in column S (not in the screenshot)

i.e.

<3 months = 0
<6 months = 10
<9 months = 15
<12 months = 20
<15 months = 25
<18 months = 30
<21 months = 35
<24 months = 40
<27 months = 45
<30+ months = 50  Register To Reply

12. ## Re: Subtract date from a current date and show difference in months and days

here is what i mean  Register To Reply

13. ## Re: Subtract date from a current date and show difference in months and days

like this in Column E

=LOOKUP(B1,{0,3,6,9,12,15,18,21,24,27},{0,10,15,20,25,30,35,40,45,"greater than/equal to 27??"})

i put text to the last if the number in B is greater than/equal to 27 what value...change it then...  Register To Reply

14. ## Re: Subtract date from a current date and show difference in months and days

=MIN(50,IF(CEILING(b1,3)/3=1,0,5*(CEILING(b1,3)/3)))  Register To Reply

15. ## Re: Subtract date from a current date and show difference in months and days Originally Posted by martindwilson =MIN(50,IF(CEILING(b1,3)/3=1,0,5*(CEILING(b1,3)/3)))
This is just brilliant ! It works perfect ! I'm speechless !

Now for god's sake can you explain how it works...  Register To Reply

16. ## Re: Subtract date from a current date and show difference in months and days

important change to formula scroll to end to see why

CEILING(b1,3) rounds up a number to the nearest multiple of 3

1rounds up to
3
2rounds up to 3
3rounds up to 3
4rounds up to 6
5rounds up to 6
6rounds up to 6
7rounds up to 9
divide the result by 3 5*CEILING(b1,3)/3
then we get
a series
1
1
1
2
2
2
3
3
3
you wanted a series 0,10,15,20...
multiply by 5 CEILING(b1,3)/3
5
5
5
10
10
10
15
15
15
since we don't want the first 5 eliminate that with an if=5 then 0 statement
IF(CEILING(b1,3)/3=1,0,5*(CEILING(b1,3)/3))
so now

1 goes to 0
2 goes to0
3 goes to0
4 goes to 10
5 goes to 10
6 goes to 10
7 goes to 15
8 goes to 15
9 goes to 15
job done but at the other end of the scale

26 goes to 45
27 goes to 45
28 goes to 50
29 goes to 50
30 goes to 50
31 goes to 55
so to limit the maximum to 50 you use MIN =MIN(a1,50) means it will always be 50 or less
therefore =MIN(50,IF(CEILING(b1,3)/3=1,0,5*(CEILING(b1,3)/3)))
having explained all that I see the borders of the formula are wrong you said
<3 months = 0
<6 months = 10
<9 months = 15
<12 months = 20
<15 months = 25
<18 months = 30
<21 months = 35
<24 months = 40
<27 months = 45
<30+ months = 50
that formula gives

<=3 months = 0
<=6 months = 10
<=9 months = 15
<=12 months = 20
<=15 months = 25
<=18 months = 30
<=21 months = 35
<=24 months = 40
<=27 months = 45
<=30+ months = 50
=IF(5*(CEILING(b1+1,3)/3)=5,0,5*(CEILING(b1+1,3)/3))
well it was 4 am uk time  Register To Reply