Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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


How would I create a third column that looks like the following:


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

But it didn't seem to work for me...

share|improve this question

migrated from Sep 16 '12 at 20:10

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 2 down vote accepted

Your outer IF has 4 arguments, but the inner one has 3. The documentation suggests that 3 is the correct number.

Does this work?

share|improve this answer
Thanks Brendan. I actually just got that same exact answer as you posted. Works like a charm. Thanks! –  user1590499 Sep 14 '12 at 20:21
Wouldn't this work? =IF(A2=0,B2,A2) –  barry houdini Sep 14 '12 at 23:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.