trim values?

daveyc18

Well-known Member
Joined
Feb 11, 2013
Messages
709
Office Version
  1. 365
  2. 2010
when i copy and paste numbers from an email,

i'm getting a bunch of spaces in front of the number, behind the number

the trim function doesnt work since it's for text...any way to get rid of spaces for values?
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Can you post some rows of your data using xl2bb

Try

Excel Formula:
=SUBSTITUTE(A2," ","")+0
 
Upvote 0
when i copy and paste numbers from an email,

i'm getting a bunch of spaces in front of the number, behind the number

the trim function doesnt work since it's for text...any way to get rid of spaces for values?

are you sure they are spaces and not tabs

sometimes text to column using spaces works ...and doing this cleans it up but then it miselses the minus sign in front

sometimes neither works (spaces or tabs)
 
Upvote 0
Try

SAMPLE (2).xlsx
CDEFGHIJ
1
2- 0.01-2195242500-2195242500-0.01-2195242500-2195242500
3-3854864560-1630265459 2,224,599,100.49-3854864560-16302654592224599100
4-7300774936-5800826166 1,499,948,769.25-7300774936-58008261661499948769
5- 119,448,676.97- 69,226,324.31 50,222,352.66-119448677-69226324.3150222352.66
6-2384140065-2507212272- 123,072,206.40-2384140065-2507212272-123072206.4
7- 51,045,800.03- 762,081,760.03- 711,035,960.00-51045800.03-762081760-711035960
8- 135,400,000.01- 0.01 135,400,000.00-135400000-0.01135400000
9
10
Sheet2
Cell Formulas
RangeFormula
G2:I8G2=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(D2," ","")," ","")," ","")+0
 
Upvote 0
Maybe:

Excel Formula:
=--SUBSTITUTE(D1:F7,CHAR(160),)
 
Upvote 0
How about
SAMPLE (2).xlsx
DEFGHI
1- 0.01-2,195,242,500.01-2,195,242,500.00-0.01-2195242500-2195242500
2-3,854,864,559.50-1,630,265,459.01 2,224,599,100.49-3854864560-16302654592224599100
3-7,300,774,935.53-5,800,826,166.27 1,499,948,769.25-7300774936-58008261661499948769
4- 119,448,676.97- 69,226,324.31 50,222,352.66-119448677-69226324.3150222352.66
5-2,384,140,065.40-2,507,212,271.80- 123,072,206.40-2384140065-2507212272-123072206.4
6- 51,045,800.03- 762,081,760.03- 711,035,960.00-51045800.03-762081760-711035960
7- 135,400,000.01- 0.01 135,400,000.00-135400000-0.01135400000
Sheet1
Cell Formulas
RangeFormula
G1:I7G1=SUBSTITUTE(D1,CHAR(160),"")+0
 
Upvote 0
Solution

Forum statistics

Threads
1,215,470
Messages
6,124,992
Members
449,201
Latest member
Lunzwe73

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