Nested IF's in Excel

Posted by user1590499 on Super User See other posts from Super User or by user1590499
Published on 2012-09-14T19:50:34Z Indexed on 2012/09/16 21:42 UTC
Read the original article Hit count: 292

Filed under:

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...

© Super User or respective owner

Related posts about microsoft-excel