Formaulating in Execel

M

Matt

Can some one help me with the following formula?

I need to create a IF formula that will start with the current date "=TODAY"
and count backwards appling a different numeric number for each year.
ie. from today back 365 days=1; from 366 to 730=2; from 730 to 1095=3; from
1095 on =4.
 
P

Peo Sjoblom

I am not sure I understand, where are the dates you are comparing TODAY()
to?
Also note that a leap year has 366 days

If the day you are testing is in A1

=VLOOKUP(TODAY()-A1,{0,1;366,2;731,3;1096,4},2)


or maybe


=IF(OR(A1="",A1>=TODAY()),"",VLOOKUP(TODAY()-A1,{0,1;366,2;731,3;1096,4},2))

to dodge blanks and dates that are today or in the future
 
S

Sloth

I am not sure what you are asking but look in the help for the function DATEDIF

example:
A1:8/23/1980
A2:=TODAY()
A3:=DATEDIF(A1,A2,"Y")

A3 results in 27, the number of complete years seperating 11/8/2007 and
8/23/1980. If A1 contained 11/23/1980 the result would be 26.

If I haven't answered your question, and you can't use DATEDIF to do what
you want, please rephrase your question and use an example to show the
results you want.
 
D

David Biddulph

=INT((TODAY()-A2)/365)+1
It's not clear whether you want to include today and/or the date in question
in your count of 365, so you may want to experiment with a +1 or -1 between
the A2 and the immediately following closing parenthesis.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top