Multiple If Statement to check for Value?


Board Regular
Dec 9, 2015
I have 14 column headers in row B

Under each column header I have an X under them, or blank

How do I concatenate in a cell using an If statement? I am currently getting an error right now

=IF(EF3 = "X", EF2, ""), IF(EG3 = "X", EG2, "") etc..

After the second IF STATEMENT I get an error?

How can I do this?


Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

It is Test, True, False for each IF statement. If the value of EF3="X" is false, it should go to the next IF statement.
Upvote 0
Hello Airfix

I guess the problem is in another cell I am trying to get the column header of all the values where there is an X in EF3 or EG3 etc..

Unfortunately it looks like it's only grabbing the ef2 now and not eg2 if there is an X
Upvote 0
OK, so there could be an X in either or both and, if so, you want the header? If there is an X in both, which header do you want? IF is a logical progression formula, once it resolves to TRUE, it considers its work done and returns the TRUE value.

Assuming that the headers are in EF2 and EG2, what is the logical requirement?
Upvote 0
Hi Airfix -

Thanks again for help, you are correct and sorry for delayed response (car broke down)

You're correct, if there is an X under say both headers, I want them both to show up in this other cell.. Any other suggestions on how to do this? Basically, if there is an X in the row under that column with an X, I want to pull the column header name.

Example. Entity ID, Name, IT Incident
X , , X

In the below example, I would want in another cell to say "Entity ID IT INCIDENT" or something a long those lines.. If I could make that into a drop down even better.
Upvote 0
Sorry to hear about the car, hope it's something simple. Excel I can do but carburetors defeat me!

How many columns would have a X in them? Which columns are they? Sorry to ask but it seemed to be two to start with and now it seems to be three (Entity ID, Name and IT Incident)
Upvote 0

So I have 16 column headers

Under each column header someone can put an X under each one to represent if that applies to them

Say for example the 16 headers were a food item
Rows under would be different customers and their food selection - they would indicate by putting an "X" under the column header

So in the cell after the 16'th column header, I am trying to get what they selected. So if they put an X under the first 3 columns and the 16'th, I could see what food items they selected based on where they put the "X".
Upvote 0
Like this?

Excel 2012
1NameFood 1Food 2Food 3Food 4Food 5Food 6Food 7Food 8Food 9Food 10Food 11Food 12Food 13Food 14Food 15Food 16Order
2AlanXXXFood 2Food 5Food 9
3BrianXXXFood 1Food 4Food 8
4CharlieXXXXFood 5Food 9Food 12Food 15
5DaveXXXXFood 3Food 7Food 11Food 16
6EricXXXXFood 4Food 7Food 11Food 15
7FrankXXXXFood 1Food 4Food 9Food 13
8GeorgeXXXXFood 2Food 6Food 10Food 14
9HughXXXFood 1Food 3Food 8
Cell Formulas
Upvote 0

What you want is ampersands rather than commas between the IF() statements to stick them all together. There is probably a more elegant way of doing it but this at least answers your original question.

=IF(EF3 = "X", EF2, "")[COLOR="#FF0000"]&[/COLOR]IF(EG3 = "X", EG2, "")

To make it prettier you probably want to add spaces before and after the cells (so EF2 would be replaced with " "&EF2&" ") and then apply the TRIM() function across the whole thing:

=TRIM(IF(EF3 = "X", " "&EF2&" ", "")[COLOR="#FF0000"]&[/COLOR]IF(EG3 = "X", " "&EG2&" ", ""))

Hope that helps

Upvote 0
You guys are literally the best!!! I can't thank you enough for taking the time to help out. I may have another question on this, but wanted to thank
Upvote 0

Forum statistics

Latest member

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back