# Find "X" in range of cells and return various values based on the column "X" is found in.

1. ## Find "X" in range of cells and return various values based on the column "X" is found in.

Hello "Smarter People Than I" ...

After 2 hours of searching for an answer to this, I give up. Can you please help with this question? (I thought it would be fairly simple to find but I was wrong!)

I have five (5) cells in a row. Only one (1) will have an "X" in it. Based on which cell (column) it is found in, I need to return a value from a list of values.

For example, if the "X" is in cell A2, return "Blue"; if it's in B2 return "Green"; if it's in C2 return "Brown"; if it's in D2 return "Black"; if it's in E2 return "Orange."

I thought of nested IF statements but that seems much more complicated then necessary?

Any help or direction will be greatly appreciated.

Thank you!!!

2. ## Re: Find "X" in range of cells and return various values based on the column "X" is found

hi NeilAZ, welcome to the forum. do you have those texts somewhere? i'm assuming they are in A1:E5, then:
=INDEX(\$A\$1:\$E\$1,MATCH("X",A2:E2,0))

if you don't have the texts anywhere, then:
=LOOKUP("X",A2:E2,{"Blue","Green","Brown","Black","Orange"})

3. ## Re: Find "X" in range of cells and return various values based on the column "X" is found

``Please Login or Register  to view this content.``
Hope this help!

4. ## Re: Find "X" in range of cells and return various values based on the column "X" is found

Hello benishiryo! Wow! That is slick! I looked and looked for a solution like this but couldn't find anything. You are awesome. Thank you!

There are currently 1 users browsing this thread. (0 members and 1 guests)