Nested IF's in Excel
- by user1590499
I have two columns with the following possibilities (0 for first column, and then 0 or 1 for second column; or a string for first column, and a 0 or 1 for second column).
name,flag
0,0
david,0
0,1
sammy,1
How would I create a third column that looks like the following:
name+flag
0
david
1
sammy
Basically, if there are 2 0's in the two columns in a row, put a 0 in the new column. if there is a string in the first column in the row, no matter what the second column in the row says, put the string in the new column. and if there is a 0 in the first column and a 1 on the second column, put a 1 in the third column.
Can I do this best with nested-if's? I tried something like
name, flag, name+flag
0,0,=IF(A2<>0,A2,IF(B2=1,B2,0),0)
But it didn't seem to work for me...