Forum Discussion

Meceka's avatar
Meceka
Copper Contributor
Nov 24, 2021
Solved

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

 

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.

  • Meceka 

    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.

9 Replies

    • Meceka's avatar
      Meceka
      Copper Contributor

      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.

      • Meceka 

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

        Enter the formula

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

        in B2 and

        =SelItems(A2,D2)

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

Resources