TEXTJOIN returns values for all rows

silverbluemoon

New Member
Joined
May 19, 2010
Messages
25
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi, all! I am certain there is something I am overlooking, so I am hoping someone here can offer a second pair of eyes to tell me what I'm doing wrong.

My reference values are in Col Q, from Q5:Q90, and my values to join together are in Col X, from X5:X90.

If I create this function:

Excel Formula:
=TEXTJOIN(", ",TRUE,IF($Q$5:$Q$90=$Q5,$X$5:$X$90,""))

I get the correct response:

Code:
1, 1, 1, 21, 2, 2, 4, 2, 4, 2, 4, 2, 4, 7

It is correct because the list grabs Col X only where Col Q continues to equal $Q5.

However, when I introduce another contingency via an additional IF statement, I also get values for all other rows in the range, incl. those where $Q$5:$Q$90<>$Q5.

In addition to the columns above, I introduce a Col W from W5:W90. My intent is to intercept a value of "Excellence" in Col W and just return a number "7", while any other values in Col X that do not have a value of "Excellence" in Col W on the same row should continue to return their actual values, as in the previous example.

Here's what I tried:

Excel Formula:
=TEXTJOIN("; ",TRUE,IF($Q$5:$Q$90=$Q5,IF($W$5:$W$90="Excellence",7,$X$5:$X$90)))

It works perfectly -- EXCEPT, I now get additional values of "FALSE" for all the other rows where Col Q does not equal $Q5.

Code:
1; 1; 1; 21; 2; 2, 4; 2, 4; 2, 4; 2, 4; 7; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE

As you can see, only the first 14 values match my expectations, and the rest are superfluous. I do not understand why this works flawlessly with one IF, but not with multiple. What am I doing wrong? How might I add additional contingencies without this happening?

Thank you in advance for your help!
 
Last edited:

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Try
Excel Formula:
=TEXTJOIN("; ",TRUE,IF($Q$5:$Q$90=$Q5,IF($W$5:$W$90="Excellence",7,$X$5:$X$90),""))
or maybe
Excel Formula:
=TEXTJOIN("; ",TRUE,IF($W$5:$W$90="Excellence",7,IF($Q$5:$Q$90=$Q5,$X$5:$X$90,"")))
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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 MrExcel.com.
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 "mrexcel.com".
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
Back
Top