How to remove a single Leading space in the numeri

2019-09-04 14:46发布

I really tried a LOT with in-built functions and also with google search but none of the ways doesn't worked out for expected result.

My exact problem is: I've few numeric columns which i got from a website and copied directly into excel.

In those columns there is a SINGLE Leading space at the beginning of each number in the cell of the entire column. Example 523946.00. In this number there is a single space before the digit 5.

I tried a lot with TRIM and SUBSTITUTE in-built functions but nothing able to resolve my problem of removing spaces.

And also my expectation is when i select two or multiple cells in the same column(spaces removed) then automatically Excel should show or display the AVERAGE: <Average value> SUM: <total Sum> COUNT: <count value> at the below status bar or bottom ribbon.

Say, AVERAGE: 175.49 COUNT: 2 SUM: 350.98

This type of information is not showing at the bottom. Only i'm able to see COUNT: 2 alone....why? I want in General Format only. No any special formats.

I'm using MS Excel 2013

5条回答
Evening l夕情丶
2楼-- · 2019-09-04 15:08

Using Excel 2007 brettdj answered this for me. This is what worked for me and it was SIMPLE!!

To remove the CHAR(160) directly without a workaround formula go to Find & Replace

in the Find What hold ALT and type 0160 using the numeric keypad then Leave Replace With as blank and select Replace All

查看更多
Anthone
3楼-- · 2019-09-04 15:09

First make sure you have the column Formatted as you would like. Make sure it is a number with 2 decimal places (or how ever many you need), then also make sure that there is no Indents (Maybe you think the Indent is a space?) And that you have it Aligned to the Left, Or where you want the Data To be. This alone should take care of your issue.

If that doesn't work here a list of possible solutions.

=Value(Trim(A1)) ' Removes all white space before and after the text in A1

=Value(Clean(A1)) 'Removes all non printable Charactersin A1

=Value(SUBSTITUTE(I3," ","")) 'Substitutes(Replaces) all instances of " "(Space) with ""(nothing)
                       '****Note: With Substitute you can also specify how many
                       ' Substitutes(Replaces) to make of the value

=Value(SUBSTITUTE(I3," ","",1)) ' Same as above but with only remove the FIRST space

 =Value(Trim(Clean(A1)))    ' Removes all white space before and after the text 
                    ' after removing all Non-Printable Characters

=Value(Trim(Clean(Substitute(A1," ","")))) ' Removes all white space before and after the 
                                    'after removing all Non-Printable Characters
                                    ' And after replaceing all spaces with nothing 

=Value(Right(A1, Len(A1)-1))  ' This takes the End of your text by the number of characters  
                     ' in the value Except the First (In your case should be the Space)


=Value(SUBSTITUTE(I6,CHAR(160),"")) 'To help with the non breaking spaces also. 

If nothing works could you please share Why you would like to remove the space? As in what you are trying to do with the data? As maybe that will open more solutions

With Ole Henrik Skogstrøm's Suggestion added Value around the functions to get the result as a value.

查看更多
三岁会撩人
4楼-- · 2019-09-04 15:12

In your case, since you always have a string of numbers, where you want to remove just the first character (a space), this formula should work:

=RIGHT(A1,LEN(A1)-1)

The numbers can vary in length, important is only, that you want to remove just 1, (or 2, or 3 etc) characters. It will still work. {If you had 2 empty spaces in front, then you would use in the formula -2, if three -3, etc)

However, if you had always a different amount of blanks in your string of numbers, like I had, you could use this formula, which worked for me:

=VALUE(SUBSTITUTE(TRIM(A1),CHAR(160),""))

,assuming that the issue you are facing is code "160". That you can find by typing: =code(A1), which in my case gave me the result "160". Therefore char(160) in the formula above.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.

戒情不戒烟
5楼-- · 2019-09-04 15:17

It may be Excel is treating your cells as text data. Is the fun Green Triangle present?

This is a common problem in excel. Forcing numeric is easier than text. Just format a column as number or General and then put in the function value() into the cells.

Things can be cleaned up from there with Copy/Paste Special values and then remove the original column.

查看更多
老娘就宠你
6楼-- · 2019-09-04 15:25

Edit:

You can actually just use find and replace.

  1. Copy one of the trouble cells.
  2. Select all the cells containing non break space, and select find and replace.
  3. Paste the copied cell into the find bar, delete everything but the last character (asuming that is the non breaking space).
  4. Leave the replace bar empty and press replace all.

This removes all non breaking spaces. :)

**Old Solution:**You can add nothing with paste special to the whole column where the spaces occur.

  1. First copy an completely empty cell. (! remember this step)

  2. Then select all cells in the column and right click and select paste special.

  3. Then select "add" almost at the bottom (see picture) and press ok.

enter image description here

This will make excel reevaluate the values as if you had modified in and entered the value manually. Excel then correctly converts them to numbers. :)

查看更多
登录 后发表回答
收藏的人(5)