Separating multiple values from same sheet in formula

mystiedx

New Member
Joined
Jun 27, 2021
Messages
18
Office Version
  1. 2019
Platform
  1. Windows
Hello!

I'm using the following formula. It may return only one or a number of values from several sheets.

Excel Formula:
=IFERROR(TEXTJOIN(", ", TRUE, IF('7 BLUE'!D$8:D$47=B$5, '7 BLUE'!$C$8:$C$47&'7 BLUE'!$F$3, "")), "") &
IFERROR(TEXTJOIN(", ", TRUE, IF('7 GREEN'!D$8:D$47=B$5, '7 GREEN'!$C$8:$C$47&'7 GREEN'!$F$3, "")), "") &
IFERROR(TEXTJOIN(", ", TRUE, IF('7 RED'!D$8:D$47=B$5, '7 RED'!$C$8:$C$47&'7 RED'!$F$3, "")), "") &
IFERROR(TEXTJOIN(", ", TRUE, IF('7 YELLOW'!D$8:D$47=B$5, '7 YELLOW'!$C$8:$C$47&'7 YELLOW'!$F$3, "")), "")

The formula works fine if all the values it returns are from separate sheets. However, if there are more than one value from the same sheet, it does not include the comma. How can I correct this?
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Try:

Excel Formula:
=TEXTJOIN(", ", TRUE,
IF('7 BLUE'!D$8:D$47=B$5, '7 BLUE'!$C$8:$C$47&'7 BLUE'!$F$3, ""),
IF('7 GREEN'!D$8:D$47=B$5, '7 GREEN'!$C$8:$C$47&'7 GREEN'!$F$3, ""),
IF('7 RED'!D$8:D$47=B$5, '7 RED'!$C$8:$C$47&'7 RED'!$F$3, ""),
IF('7 YELLOW'!D$8:D$47=B$5, '7 YELLOW'!$C$8:$C$47&'7 YELLOW'!$F$3, ""))
 
Upvote 1
Solution
Try:

Excel Formula:
=TEXTJOIN(", ", TRUE,
IF('7 BLUE'!D$8:D$47=B$5, '7 BLUE'!$C$8:$C$47&'7 BLUE'!$F$3, ""),
IF('7 GREEN'!D$8:D$47=B$5, '7 GREEN'!$C$8:$C$47&'7 GREEN'!$F$3, ""),
IF('7 RED'!D$8:D$47=B$5, '7 RED'!$C$8:$C$47&'7 RED'!$F$3, ""),
IF('7 YELLOW'!D$8:D$47=B$5, '7 YELLOW'!$C$8:$C$47&'7 YELLOW'!$F$3, ""))
Works perfect! Thanks loads. :)
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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