Need help with copy values in comma seperated data into another column conditionally

Occasional Contributor


I'm using Office 365 excel with intel mac.

There is a sample excel file below. Each value in column A has corresponding order in column D. For example in A2 first line 'False' is matched with 'Countryside Mobility Newsletter' and the second line 'True' is matched with the second value after the comma in column D 'Deaf Led Services Information'. 


My target is if there is at least one true in column A, it should print "opt-in" in column B. İf there is nothing, the column remains blank.

Also if there is at least one true in column A, it's corresponding part in column D should print column C. 


İs there any formula to do that? I appreciate any help.

9 Replies


See the attached version. It uses a VBA function, so you will have to allow macros when you open the workbook.

You can't imagine how much you made me happy. Don't how to say thank you
One thing I didn't understand here. How can I use this function with 20.000 rows of data in the same format? Can you explain to me like I'm five, please?


What I mean by that, they will ask me how they can use this function on their own. İnstead of just answer, I'm trying to understand this approach. 


Huge thanks.


Yes, it will work on a large data set too.

Enter the formula

=IF(ISNUMBER(FIND("True",A2)),"Opt In","")

in B2 and


in C2. then select B2:C20000 (i.e. to the last used row) and press Ctrl+D to fill down.

@Hans Vogelaar I get this error with second function.


Do you use comma as decimal separator? If so, you must use semicolon between the arguments of the formula:



@Hans Vogelaar I've tried maybe tens of various ways to make it work. I'm missing something here I guess. 


I want to mention something. The first file you attached as an answer both functions working properly. But this is just sample file. My target is to take this function and paste the original one to make it work. As you said the file includes VBA function that's why it worked actually. The thing makes me confusing is how did you write this function? İf I can reach it, then maybe I can write a VBA function for the original one as well. I'm talking as a beginner. Correct me please if I'm wrong.

best response confirmed by Meceka (Occasional Contributor)


Open your 'real' workbook and my sample workbook.

Press Alt+F11 to activate the Visual Basic Editor.

Look at the Project Explorer pane on the left hand side.

If necessary expand my sample workbook and then Modules under it.

You should see Module1:


Drag Module1 to your real workbook. This will copy the module, making the function available in your workbook.

You can view the code by double-clicking Module1.

You guys are heroes! Thank you so much for your time, Hans.

@Hans Vogelaar Hi Hans,


After I run code, I realized there is something wrong with the code. Normally if there is a 'True' in A column, it should print the corresponding part( second item) in D column. Every time it's printing the first item in the D column to the C column. 


Can you fix that?