Remove Ending commas from formula result

gmooney

Board Regular
Joined
Oct 21, 2004
Messages
242
Office Version
  1. 365
Platform
  1. Windows
I have the following formula that generates the following result

VBA Code:
=UPPER(AW171)&" - "&"including the following Subcategories" & PROPER(" - "&AW172&", "&AX172&", "&AY172&", "&AZ172&", "&BA172&", "&BB172&", "&BC172&", "&BD172&", "&BE172&", "&BF172&", "&BG172&", "&BH172&", "&BI172)

PACKAGED BEVERAGES - including the following Subcategories - Bottled Water, Carbonated Soft Drinks, Energy Drinks, Enhanced Water, Iced Tea Ready To Drink, Other Packaged Beverages, Sports Drinks, , , , , ,

I need to remove any commas at the end because as cell AW171 (PACKAGED BEVERAGES) gets changed to something else the resulting values in the columns of 172 will not always be the same number of real values. Some categories have 2 or 3 sub categories while others have 10.

The end result would like this below where the string doesn't end in any commas.

PACKAGED BEVERAGES - including the following Subcategories - Bottled Water, Carbonated Soft Drinks, Energy Drinks, Enhanced Water, Iced Tea Ready To Drink, Other Packaged Beverages, Sports Drinks

Any ideas?
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
65,938
Office Version
  1. 365
Platform
  1. Windows
How about
Excel Formula:
=UPPER(AW171)&" - "&"including the following Subcategories - " & PROPER(TEXTJOIN(", ",,AW172:BI172))
 
Solution

gmooney

Board Regular
Joined
Oct 21, 2004
Messages
242
Office Version
  1. 365
Platform
  1. Windows
How about
Excel Formula:
=UPPER(AW171)&" - "&"including the following Subcategories - " & PROPER(TEXTJOIN(", ",,AW172:BI172))
VERY SLICK. Thank you!
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
65,938
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

JackDanIce

Well-known Member
Joined
Feb 3, 2010
Messages
9,890
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

Try:
Excel Formula:
=UPPER(A171)&" - including the following Subcategories - "&PROPER(TEXTJOIN(", ",1,AW172:BI172))
 

JackDanIce

Well-known Member
Joined
Feb 3, 2010
Messages
9,890
Office Version
  1. 365
Platform
  1. Windows
Haha thanks @Fluff, nice spot and I posted my suggestion without seeing there had been updates to the thread!
 

Forum statistics

Threads
1,148,187
Messages
5,745,230
Members
423,936
Latest member
Conservatopia

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
Top