TRIM Formula - Remove Comma from value in cell

hrayani

Well-known Member
Joined
Jul 23, 2010
Messages
1,501
Office Version
  1. 2016
Platform
  1. Windows
Hi All,

I need a formula to remove commas from a cell...

Sample Data

123, 456, 567,,,,,, required answer 123, 456, 567
990,256,, reqiured answer 990,256
12567, 308211, required answer 12567, 308211

I want all commas to be removed which are at the end of the cell value

Any help would be appreciated

Regards,

Humayun
 
Last edited:

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Hi Sandy,

Thanks for the reply

There is one issue i.e. there are some cell containing value like below (sorry i should have mentioned it in the first post)

14778971 A, 14778971 B, , , ,

Answer should be ----> 14778971 A, 14778971 B

<tbody>
</tbody>

whereas, it is showing 14778971, A, 14778971, B

<tbody>
</tbody>

Any Idea ???
 
Upvote 0
This should do it:

=TRIM(LEFT(SUBSTITUTE(SUBSTITUTE(A1,", ,",",,")&",,",",,",REPT(" ",99)),99))
 
Upvote 0
Hi Steve,

Thanks problem solved.... formula you provided is working Perfect...


Just wanted to ask you that will the formula work for any number of commas at the end of the cell or is there a limit to it ??
 
Upvote 0
Any number of commas will be fine. It wont work however if there are pairs of commas in the middle of the string.
 
Upvote 0
Thanks one last thing... for a range of cells

Example...

A1 = 256
A2 = Humayun
A3 = Abc

Required Answer in A4 = 256, Humayun, Abc

Like combine/concatenate all the cells in the range with commas....
 
Upvote 0
Textjoin if you have it:

=TEXTJOIN(",",TRUE,A1:A3)

or if not concatenate.

=CONCATENATE(A1,",",A2,",",A3)
 
Upvote 0
Hi Steve,

Textjoin not working...

Concatenate is fine but for that all the cells in the range will have to have some values in there...

I also realise that i should start a new thread for this one as the formula i need now is a whole new story altogether.
 
Upvote 0

Forum statistics

Threads
1,215,651
Messages
6,126,025
Members
449,281
Latest member
redwine77

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