# Excel - IF Function Problem - Expert Solution

Question description:
This user has given permission to use the problem statement for this blog.

I have a spreadsheet with a lot of columns and want a cell in each row that will have a comma-separated list of the columns that have data. Essentially, I think I need to create multiple "IF" functions within a cell that will output comma separated text based on whether a column is blank or not.
Solved by K. L. in 27 mins
This is the chat thread from the real Excelchat help session. It contains no private user information.
Excelchat Expert 01/03/2018 - 07:31
Welcome to excel got it pro.
Excelchat Expert 01/03/2018 - 07:31
Excelchat Expert 01/03/2018 - 07:31
Would you please show me an example of what you want?
Excelchat Expert 01/03/2018 - 07:33
In the preview sheet?
User 01/03/2018 - 07:35
Yep, thank you!
Excelchat Expert 01/03/2018 - 07:35
Okay, waiting for it.
User 01/03/2018 - 07:36
I want column C to create a comma-separated list of the foods (ex. in column D and E)
User 01/03/2018 - 07:36
but for a large list of foods (essentially 40 columns)
Excelchat Expert 01/03/2018 - 07:37
Sorry, Still I'm a little behind.
User 01/03/2018 - 07:38
I'm not sure if I'm being terribly clear
User 01/03/2018 - 07:38
but essentially want column C to be able to summarize which columns have data
User 01/03/2018 - 07:39
(like how I just demonstrated?)
Excelchat Expert 01/03/2018 - 07:39
Okay, let me rephrase it, so that we know we are in the same page.
User 01/03/2018 - 07:39
thank you
Excelchat Expert 01/03/2018 - 07:40
If a column is non empty and greater than 0, then list that item in column C, right?
User 01/03/2018 - 07:40
correct
Excelchat Expert 01/03/2018 - 07:41
can a cell be empty?
User 01/03/2018 - 07:42
If a cell is empty, I do not want it to be listed
Excelchat Expert 01/03/2018 - 07:42
got it, understood. I need a couple of minutes.
User 01/03/2018 - 07:42
thank you!
Excelchat Expert 01/03/2018 - 07:51
=IF(D2>0,\$D\$1,"")&IF(E2>0,", "&\$E\$1,"") Please use this formula.
Excelchat Expert 01/03/2018 - 07:51
I have used it in column G.
User 01/03/2018 - 07:52
And can I use a variation on that for 39 relevant columns?
Excelchat Expert 01/03/2018 - 07:53
Yup, Just need to add a variation of &IF(F2>0,", "&\$F\$1,"") is for each extra column.
User 01/03/2018 - 07:53
THANK YOU SO MUCH!!!
User 01/03/2018 - 07:53
This is a massive massive help
Excelchat Expert 01/03/2018 - 07:53
My pleasure.
Excelchat Expert 01/03/2018 - 07:53
A five star rating would be much appreciated.
Excelchat Expert 01/03/2018 - 07:53
To rate me click on the end session button.
Excelchat Expert 01/03/2018 - 07:53
Thanks and have a great day!
User 01/03/2018 - 07:54
Will do, thanks a bunch!
Excelchat Expert 01/03/2018 - 07:55
A friendly reminder, it is important to close session, otherwise I'm stuck here and won't able to help others. So, if you don't need my help any longer, please close the session. :)

This is the output file from the real Excelchat help session:
This is an example of the expert help you can get. It contains no private user information.

Get instant expert help with Excel and Google Sheets

#### Post your problem and you’ll get expert help in seconds.

Your message must be at least 40 characters
Your privacy is guaranteed. Your session will not be used for blog unless you give us persmission.