View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Jeremy Jeremy is offline
external usenet poster
 
Posts: 184
Default 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.