Nov 24 2021 05:38 AM
Nov 24 2021 05:38 AM
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.
Nov 24 2021 05:57 AM
See the attached version. It uses a VBA function, so you will have to allow macros when you open the workbook.
Nov 24 2021 06:07 AM - edited Nov 24 2021 06:09 AM
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.
Nov 24 2021 08:18 AM
Yes, it will work on a large data set too.
Enter the formula
in B2 and
in C2. then select B2:C20000 (i.e. to the last used row) and press Ctrl+D to fill down.
Nov 24 2021 08:57 AM - edited Nov 24 2021 08:58 AM
Do you use comma as decimal separator? If so, you must use semicolon between the arguments of the formula:
Nov 24 2021 09:03 AM
@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.
Nov 24 2021 12:16 PMSolution
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.
Nov 24 2021 12:19 PM
Nov 24 2021 11:11 PM
@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?