Remove Ending commas from formula result

gmooney

Active Member
Joined
Oct 21, 2004
Messages
252
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

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
How about
Excel Formula:
=UPPER(AW171)&" - "&"including the following Subcategories - " & PROPER(TEXTJOIN(", ",,AW172:BI172))
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0
Try:
Excel Formula:
=UPPER(A171)&" - including the following Subcategories - "&PROPER(TEXTJOIN(", ",1,AW172:BI172))
 
Upvote 0
Haha thanks @Fluff, nice spot and I posted my suggestion without seeing there had been updates to the thread!
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,854
Members
449,051
Latest member
excelquestion515

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