Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
nested if statements
Here's the situation: I'm trying to return a specific value to the cell based
on conditions in 4 cells in the same row. If A is valid (in this case1966), then I want to check B to see if that has a valid value (also 1966). If both these conditions are true, then I want to check to see whether A and B agree. If all 3 things are true, then I want to see a value of 1. If the first 2 are true (A and B are both valid) but the 3rd is not (A is not equal to B), then the value in the cell should be equal to (A-B)+1. If the first condition is true (A 1966), but the 2nd is not, I want to return a value of 1. If the first condition (A1966) is false, then I want to check B for a valid value (1966). If B is valid, then I want to return a value of 1. If not, then I want to check C for validity. If C is valid (1966), then I want to return a value of C-D. If it is not, then I'd like to return a value of 2007-D. This is the formula I use: IF(A11966,if(b11966,if(a1=b1,1(a1-b1+1),1,IF(B11966,1,IF(C11966,(C1-D1)+1,2007-D1))) I get "The formula you typed contains an error". I can't figure out the error. Any help will be greatly appreciated. |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
nested if statements
I think it is this part that is causing your problem:
if(a1=b1,1(a1-b1+1) maybe you need a comma between the first "1" and the (a1-b1+1) "Jeremy" wrote: Here's the situation: I'm trying to return a specific value to the cell based on conditions in 4 cells in the same row. If A is valid (in this case1966), then I want to check B to see if that has a valid value (also 1966). If both these conditions are true, then I want to check to see whether A and B agree. If all 3 things are true, then I want to see a value of 1. If the first 2 are true (A and B are both valid) but the 3rd is not (A is not equal to B), then the value in the cell should be equal to (A-B)+1. If the first condition is true (A 1966), but the 2nd is not, I want to return a value of 1. If the first condition (A1966) is false, then I want to check B for a valid value (1966). If B is valid, then I want to return a value of 1. If not, then I want to check C for validity. If C is valid (1966), then I want to return a value of C-D. If it is not, then I'd like to return a value of 2007-D. This is the formula I use: IF(A11966,if(b11966,if(a1=b1,1(a1-b1+1),1,IF(B11966,1,IF(C11966,(C1-D1)+1,2007-D1))) I get "The formula you typed contains an error". I can't figure out the error. Any help will be greatly appreciated. |
#3
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
nested if statements
IF(A11966,if(b11966,if(a1=b1,1(a1-b1+1),1,IF(B11966,1,IF(C11966,(C1-D1)+1,2007-D1)))
IF(and(A11966,B11966),if(a1=b1,1,a1-b1+1),IF(and(A1<=1966,B11966),1,IF(C11966,C1-D1,2007-D1))) "Jeremy" wrote: Here's the situation: I'm trying to return a specific value to the cell based on conditions in 4 cells in the same row. If A is valid (in this case1966), then I want to check B to see if that has a valid value (also 1966). If both these conditions are true, then I want to check to see whether A and B agree. If all 3 things are true, then I want to see a value of 1. If the first 2 are true (A and B are both valid) but the 3rd is not (A is not equal to B), then the value in the cell should be equal to (A-B)+1. If the first condition is true (A 1966), but the 2nd is not, I want to return a value of 1. If the first condition (A1966) is false, then I want to check B for a valid value (1966). If B is valid, then I want to return a value of 1. If not, then I want to check C for validity. If C is valid (1966), then I want to return a value of C-D. If it is not, then I'd like to return a value of 2007-D. This is the formula I use: IF(A11966,if(b11966,if(a1=b1,1(a1-b1+1),1,IF(B11966,1,IF(C11966,(C1-D1)+1,2007-D1))) I get "The formula you typed contains an error". I can't figure out the error. Any help will be greatly appreciated. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Returning text from nested IF and Vlookup statements | Excel Worksheet Functions | |||
Nested If Statements | Excel Worksheet Functions | |||
UDFunctions and nested If-the-else statements | Excel Worksheet Functions | |||
multiple nested IF statements | Excel Worksheet Functions | |||
Nested IF statements | Excel Worksheet Functions |