Question

Im taking info from COLUMN C depending on what it contains and giving it a Letter value of say A and so on. Its Working, but it is putting my A in the COLUMN next to where I placed the code for some reason for 'Name2'.

So this code is being placed in COLUMN P. Anything containing Name1 shows an A in COLUMN P but anything Name2 shows an A in Column Q. How can I fix this so everything is in COLUMN P.

=ArrayFormula(IF(LEN(A3:A),IF(C3:C={"Name1","Name2"},"A","")))

Can someone please be kind enough to show me whats wrong? ; ) Thanks in advance!

Was it helpful?

Solution

A value is being populated in the next column because you are effectively creating a 2-column array with the first argument of the IF.

For an array formula you can use the + operator to apply OR logic:

=ARRAYFORMULA(IF(LEN(A3:A),IF((C3:C="Name1")+(C3:C="Name2"),"A",""),))

or if you had a longer list of allowable entries, something like this would be easier to scale:

=ARRAYFORMULA(IF(LEN(A3:A),IF(ISNUMBER(MATCH(C3:C,{"Name1";"Name2"},0)),"A",""),))

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top