Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Help with if statement
I have used the following statement, but it is returning an incorrect result
for some cells. In an cell containing an age of 10 years, 11months..the formula is returning "6m-2y" when it should say older than 2. It also does this for the age 25 years 6 months and 18 years 10 months. Please help. =IF(AND(E203="0years,0months",E203<="0years,3mont hs"),"0-3",IF(AND(E203"0years,3months",E203<="0years,6mon ths"),"3-6",IF(AND(E203"0years,6months",E203<="2years,0mon ths"),"6m - 2y",IF(AND(E203"2years,0months",E203<="99years,0m onths"),"Older than 2","")))) |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Help with if statement
It looks like it's returning the correct result to me.
The string "10 years, 11months" satisfies the AND(E203"0years,6months",E203<="2years,0months") condition, because the first digit 1 is greater than 0 and is less than 2. Perhaps you've forgotten that you are comparing text strings, not comparing numbers? -- David Biddulph "ck" wrote in message ... I have used the following statement, but it is returning an incorrect result for some cells. In an cell containing an age of 10 years, 11months..the formula is returning "6m-2y" when it should say older than 2. It also does this for the age 25 years 6 months and 18 years 10 months. Please help. =IF(AND(E203="0years,0months",E203<="0years,3mont hs"),"0-3",IF(AND(E203"0years,3months",E203<="0years,6mon ths"),"3-6",IF(AND(E203"0years,6months",E203<="2years,0mon ths"),"6m - 2y",IF(AND(E203"2years,0months",E203<="99years,0m onths"),"Older than 2","")))) |
#3
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Help with if statement
ck wrote:
I have used the following statement, but it is returning an incorrect result for some cells. In an cell containing an age of 10 years, 11months..the formula is returning "6m-2y" when it should say older than 2. It also does this for the age 25 years 6 months and 18 years 10 months. Please help. =IF(AND(E203="0years,0months",E203<="0years,3mont hs"),"0-3",IF(AND(E203"0years,3months",E203<="0years,6mon ths"),"3-6",IF(AND(E203"0years,6months",E203<="2years,0mon ths"),"6m - 2y",IF(AND(E203"2years,0months",E203<="99years,0m onths"),"Older than 2","")))) What is in E203? |
#4
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Help with if statement
ck, I played with your formula and found that if you use 00years,00months --
create the accepability of a double digit number -- which you will have since the months in a year may be a single or a double digit number (0, 1, 2, . . . 9, 10, 11). Just change the formula to read: =IF(AND(E203="00years,00months",E203<="00years,03 months"),"0-3",IF(AND(E203"00years,03months",E203<="00years,0 6months"),"3-6",IF(AND(E203"00years,06months",E203<="02years,0 0months"),"6m - 2y",IF(AND(E203"02years,00months",E203<="99years, 00months"),"Older than 2","")))) "ck" wrote: I have used the following statement, but it is returning an incorrect result for some cells. In an cell containing an age of 10 years, 11months..the formula is returning "6m-2y" when it should say older than 2. It also does this for the age 25 years 6 months and 18 years 10 months. Please help. =IF(AND(E203="0years,0months",E203<="0years,3mont hs"),"0-3",IF(AND(E203"0years,3months",E203<="0years,6mon ths"),"3-6",IF(AND(E203"0years,6months",E203<="2years,0mon ths"),"6m - 2y",IF(AND(E203"2years,0months",E203<="99years,0m onths"),"Older than 2","")))) |
#5
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Help with if statement
e203 contains the age calculated in years and months by using the following
formula: =DATEDIF(D203,B203,"y")&"years,"&DATEDIF(D203,B203 ,"ym")&"months" "Glenn" wrote: ck wrote: I have used the following statement, but it is returning an incorrect result for some cells. In an cell containing an age of 10 years, 11months..the formula is returning "6m-2y" when it should say older than 2. It also does this for the age 25 years 6 months and 18 years 10 months. Please help. =IF(AND(E203="0years,0months",E203<="0years,3mont hs"),"0-3",IF(AND(E203"0years,3months",E203<="0years,6mon ths"),"3-6",IF(AND(E203"0years,6months",E203<="2years,0mon ths"),"6m - 2y",IF(AND(E203"2years,0months",E203<="99years,0m onths"),"Older than 2","")))) What is in E203? . |
#6
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Help with if statement
I changed the formula and I am still getting errors...Do I need to change
anything to create the acceptability of a double digit number? "nita" wrote: ck, I played with your formula and found that if you use 00years,00months -- create the accepability of a double digit number -- which you will have since the months in a year may be a single or a double digit number (0, 1, 2, . . . 9, 10, 11). Just change the formula to read: =IF(AND(E203="00years,00months",E203<="00years,03 months"),"0-3",IF(AND(E203"00years,03months",E203<="00years,0 6months"),"3-6",IF(AND(E203"00years,06months",E203<="02years,0 0months"),"6m - 2y",IF(AND(E203"02years,00months",E203<="99years, 00months"),"Older than 2","")))) "ck" wrote: I have used the following statement, but it is returning an incorrect result for some cells. In an cell containing an age of 10 years, 11months..the formula is returning "6m-2y" when it should say older than 2. It also does this for the age 25 years 6 months and 18 years 10 months. Please help. =IF(AND(E203="0years,0months",E203<="0years,3mont hs"),"0-3",IF(AND(E203"0years,3months",E203<="0years,6mon ths"),"3-6",IF(AND(E203"0years,6months",E203<="2years,0mon ths"),"6m - 2y",IF(AND(E203"2years,0months",E203<="99years,0m onths"),"Older than 2","")))) |
#7
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Help with if statement
OK, so E203 contains TEXT. Try this instead:
=IF(DATEDIF(D203,B203,"M")<3,"0-3",IF(DATEDIF(D203,B203,"M")<6,"3-6", IF(DATEDIF(D203,B203,"M")<24,"6m - 2Y","Older than 2"))) ck wrote: e203 contains the age calculated in years and months by using the following formula: =DATEDIF(D203,B203,"y")&"years,"&DATEDIF(D203,B203 ,"ym")&"months" "Glenn" wrote: ck wrote: I have used the following statement, but it is returning an incorrect result for some cells. In an cell containing an age of 10 years, 11months..the formula is returning "6m-2y" when it should say older than 2. It also does this for the age 25 years 6 months and 18 years 10 months. Please help. =IF(AND(E203="0years,0months",E203<="0years,3mont hs"),"0-3",IF(AND(E203"0years,3months",E203<="0years,6mon ths"),"3-6",IF(AND(E203"0years,6months",E203<="2years,0mon ths"),"6m - 2y",IF(AND(E203"2years,0months",E203<="99years,0m onths"),"Older than 2","")))) What is in E203? . |
#8
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Help with if statement
Did you remember to change your E203 formula to give 2 digits for years and
months? Does your formula look like: =TEXT(DATEDIF(D203,B203,"y"),"00")&"years,"&TEXT(D ATEDIF(D203,B203,"ym"),"00")&"months" ? -- David Biddulph "ck" wrote in message ... I changed the formula and I am still getting errors...Do I need to change anything to create the acceptability of a double digit number? "nita" wrote: ck, I played with your formula and found that if you use 00years,00months -- create the accepability of a double digit number -- which you will have since the months in a year may be a single or a double digit number (0, 1, 2, . . . 9, 10, 11). Just change the formula to read: =IF(AND(E203="00years,00months",E203<="00years,03 months"),"0-3",IF(AND(E203"00years,03months",E203<="00years,0 6months"),"3-6",IF(AND(E203"00years,06months",E203<="02years,0 0months"),"6m - 2y",IF(AND(E203"02years,00months",E203<="99years, 00months"),"Older than 2","")))) "ck" wrote: I have used the following statement, but it is returning an incorrect result for some cells. In an cell containing an age of 10 years, 11months..the formula is returning "6m-2y" when it should say older than 2. It also does this for the age 25 years 6 months and 18 years 10 months. Please help. =IF(AND(E203="0years,0months",E203<="0years,3mont hs"),"0-3",IF(AND(E203"0years,3months",E203<="0years,6mon ths"),"3-6",IF(AND(E203"0years,6months",E203<="2years,0mon ths"),"6m - 2y",IF(AND(E203"2years,0months",E203<="99years,0m onths"),"Older than 2","")))) |
#9
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Help with if statement
You are a genious! Thank you! Thank you!
"Glenn" wrote: OK, so E203 contains TEXT. Try this instead: =IF(DATEDIF(D203,B203,"M")<3,"0-3",IF(DATEDIF(D203,B203,"M")<6,"3-6", IF(DATEDIF(D203,B203,"M")<24,"6m - 2Y","Older than 2"))) ck wrote: e203 contains the age calculated in years and months by using the following formula: =DATEDIF(D203,B203,"y")&"years,"&DATEDIF(D203,B203 ,"ym")&"months" "Glenn" wrote: ck wrote: I have used the following statement, but it is returning an incorrect result for some cells. In an cell containing an age of 10 years, 11months..the formula is returning "6m-2y" when it should say older than 2. It also does this for the age 25 years 6 months and 18 years 10 months. Please help. =IF(AND(E203="0years,0months",E203<="0years,3mont hs"),"0-3",IF(AND(E203"0years,3months",E203<="0years,6mon ths"),"3-6",IF(AND(E203"0years,6months",E203<="2years,0mon ths"),"6m - 2y",IF(AND(E203"2years,0months",E203<="99years,0m onths"),"Older than 2","")))) What is in E203? . . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
IF statement inside a SUMIF statement.... or alternative method | Excel Worksheet Functions | |||
Reconcile Bank statement & Credit card statement & accounting data | Excel Worksheet Functions | |||
Embedding an OR statement in an IF statement efficiently | Excel Discussion (Misc queries) | |||
If statement or lookup statement not sure | Excel Worksheet Functions | |||
appending and IF statement to an existing IF statement | Excel Worksheet Functions |