Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I'm trying to calculate a formula in Excel using the IF function. Here is my
code. =IF(B2=9/1/2006,5,IF(B2=6/1/2006,4,IF(B2=3/1/2006,3,IF(B2=1/1/2006,2,IF(B2=9/1/2005,1,0))))) Basically this is what I want returned. If B2=9/1/2006 then it equals 5 If B2=6/1/2006 then it equals 4 If B2=3/1/2006 then it equals 3 If B2=1/1/2006 then it equals 2 If B2=9/1/2005 then it equals 1 I have a feeling the my setup in the formula is rubbish. But what is making me scratch my head the most is that it worked perfectly fine before! Any help would be ultra appreciated. Thank you much! Have a nice day. |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Try this:
IF(B2=DATEVALUE("9/1/2006"),5,IF(B2=DATEVALUE("6/1/2006"),4,IF(B2=DATEVALUE("3/1/2006"),3,IF(B2=DATEVALUE("1/1/2006"),2,IF(B2=DATEVALUE("9/1/2005"),1,0))))) HTH sqlfan13 "david@pcm" wrote: I'm trying to calculate a formula in Excel using the IF function. Here is my code. =IF(B2=9/1/2006,5,IF(B2=6/1/2006,4,IF(B2=3/1/2006,3,IF(B2=1/1/2006,2,IF(B2=9/1/2005,1,0))))) Basically this is what I want returned. If B2=9/1/2006 then it equals 5 If B2=6/1/2006 then it equals 4 If B2=3/1/2006 then it equals 3 If B2=1/1/2006 then it equals 2 If B2=9/1/2005 then it equals 1 I have a feeling the my setup in the formula is rubbish. But what is making me scratch my head the most is that it worked perfectly fine before! Any help would be ultra appreciated. Thank you much! Have a nice day. |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
You might try:
=IF(B2=38961,5,IF(B2=38869,4,IF(B2=38777,3,IF(B 2=38718,2,IF(B2=38596,1,0))))) HTH, Paul "david@pcm" wrote in message ... I'm trying to calculate a formula in Excel using the IF function. Here is my code. =IF(B2=9/1/2006,5,IF(B2=6/1/2006,4,IF(B2=3/1/2006,3,IF(B2=1/1/2006,2,IF(B2=9/1/2005,1,0))))) Basically this is what I want returned. If B2=9/1/2006 then it equals 5 If B2=6/1/2006 then it equals 4 If B2=3/1/2006 then it equals 3 If B2=1/1/2006 then it equals 2 If B2=9/1/2005 then it equals 1 I have a feeling the my setup in the formula is rubbish. But what is making me scratch my head the most is that it worked perfectly fine before! Any help would be ultra appreciated. Thank you much! Have a nice day. |
#4
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi David
If you wanted a formula solution rather than using multiple IF statements, then try =INT(MOD((MONTH(A1)+3),12)/3)+1 +4*(DATEDIF(DATE(2005,9,1),A1,"Y")) -- Regards Roger Govier "david@pcm" wrote in message ... I'm trying to calculate a formula in Excel using the IF function. Here is my code. =IF(B2=9/1/2006,5,IF(B2=6/1/2006,4,IF(B2=3/1/2006,3,IF(B2=1/1/2006,2,IF(B2=9/1/2005,1,0))))) Basically this is what I want returned. If B2=9/1/2006 then it equals 5 If B2=6/1/2006 then it equals 4 If B2=3/1/2006 then it equals 3 If B2=1/1/2006 then it equals 2 If B2=9/1/2005 then it equals 1 I have a feeling the my setup in the formula is rubbish. But what is making me scratch my head the most is that it worked perfectly fine before! Any help would be ultra appreciated. Thank you much! Have a nice day. |
#5
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
=LOOKUP(B2,--{0,"9/1/5","1/1/6","3/1/6","6/1/6","9/1/6"},{0,1,2,3,4,5})
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Using Excel 2000 VBA Application on Excel 2003 | Excel Worksheet Functions | |||
Excel problem Office 2000 Illegal operation...? Help... | Excel Discussion (Misc queries) | |||
=HYPERLINK function and Excel 2003 problem. | Excel Worksheet Functions | |||
"Group" function very slow with Excel 2003 :( ... While very quick with Excel2000 :O) | Excel Discussion (Misc queries) | |||
Excel 2000 shared workbook problem | Excel Discussion (Misc queries) |