Jun 23 2018 01:38 PM
Jun 23 2018 01:38 PM
I have been helping a friend organize a excel file with 4 digit numbers. These numbers are in the 6000 to 8000 range. When I filter or sort the numbers from smallest to largest there are numbers , in the 6200 to 6800 range, missing where they should be and then excel places them in order farther down in the 7000 to 8000 range. I am sure there is an answer and I did find that version 16.9 and above have issues. Is anyone else having this issue and if so, what can be done?
Jun 23 2018 02:10 PM
Nope, in my case it works as expected. Are your numbers are integers in Excel, or that texts? Did you generate them manually (e.g. fill series) or copy/pasted from Web for example?
Jun 23 2018 05:50 PM
Jun 24 2018 05:49 AM
If they are not generated within Excel but copy/pasted from the Web, most probably you have non-printable characters inside your cells with numbers. That doesn't matter you used same site or not.
You may check by LEN() applied to cells if all of them returns 4.
If not you may apply =CLEAN(A1)*1 to such cells to remove non-printable characters.
Apr 15 2019 06:34 AM
@Sergei Baklan Thank you, the =CLEAN function helped me out immensely. I cannot see any difference between the input and the output, but the output I can sort properly. Thanks again!
Apr 15 2019 10:41 AM
@DLans , so far so good, you are welcome. You could see the difference if check =LEN(A1) and =LEN(CLEAN(A1)) if in A1 is initial value
May 20 2019 05:35 AM
@Sergei Baklan, can you explain in detail how to do this, how do I apply this, where do i type it, find it, etc.
Jun 07 2019 10:51 AM
These replies are not helping me troubleshoot my issue -
I have no hidden columns, no formulas, nothing but raw data in my spreadsheet - yet when I sort from small to large or vice versa with cell formatting in "number" format, it sorts the majority correctly then puts several at the bottom that are out of sequence. I've copied the cell format of one that sorts correctly and pasted to those that didn't, then resorted to see if it worked but it doesn't. I don't know what to do to fix this major annoying problem - any suggestions are appreciated.
Jun 07 2019 11:14 AM
@KerrilynnAZ , if in any empty cell you try =ISNUMBER() on one the cells which are in the bottom, what will be the result?
Jun 07 2019 01:06 PM
@Sergei Baklan I ended up googling the formula =CLEAN(A2) to strip nonprintable characters from cell text and was able to get that to work in this situation. Rather cumbersome but at least I had success and will be able to continue using that to help me. I'm going include my notes that I wrote that worked for me in case anyone else can find this of benefit to them:
Issue: Exporting to Excel from another database may have created characters that are hidden which impacts the ability to sort columns correctly. (Simply changing the cell format from text or general or to number format will not correct the problem) This can be fixed using the CLEAN formula below:
=CLEAN(A2) Strip non-printable characters from the cell. Non-printable characters constitute the first 32 characters of the 7-bit ASCI code, which houses the 128 text characters used by all computers for data storage and computing. Because 7-bit ASCI code is widely used in computer processing, copying and pasting data from other applications or business databases frequently copies the nonprintable characters too. To remove nonprintable characters:
As an example:
To clean A2 through A25: (assuming row 1 is the title field)
Jun 13 2019 09:12 AM
@KerrilynnAZ Thats how I ended up solving the problem for me :) Copying data indeed somehow created characters that I couldn't see, but with the =CLEAN function and the steps you described I could sort them correctly.
Jun 13 2019 09:35 AM
@DLans YOU just made my day! ;-) It makes it worthwhile when you can share knowledge that someone else finds of benefit - especially in these scenario's. I hate wasting time trying to figure out problems that I can't find quick answers to in order to keep me moving forward, LOL. Thank You!
Jan 05 2021 07:12 PM
I made an account just to let anybody Googling this know...
My numbers had spaces after them, darn things! =ISNUMBER could tell they weren't "numbers" even though I'd set the cell format to Number. =CLEAN didn't work; paste special > values didn't work.
What worked was.... =TRIM! (I only thought of this because I just used Data > Trim Whitespace in Google Sheets last week.)
So if you paste special (as values) your data from the web, and/or clean them, and they still won't sort, try:
Jan 06 2021 04:23 AM
Just in case, CLEAN() removes characters with ASCII codes from 0 to 31, TRIM() removes space (code 32). But no one of them removes non-breaking space (code 160) which is the most often case when copy/paste from web.
Apr 14 2021 01:34 PM
Any other ideas? Neither =clean(A2) nor =trim(A2) work in my case.
My data is not from the web, is a result of a INDEX MATCH horizontal lookup.
Apr 15 2021 06:17 AM
They are actually numbers but I found the solution to my problem... the issue was that excel automatically references the worksheet where you are pulling data from even if it is in the same active worksheet when using the match or even vlookup functions. I just had to delete that reference and problem fixed.
Find below detailed explanation:
Thanks for the replay!
Jan 10 2022 07:01 AM
Try selecting the cells that contain the numbers and changing the formatting to NUMBER this in my case showed me the cells that have numbers after the decimal. I removed the decimals and was able to sort as usual
May 30 2022 07:54 PM
Sep 01 2022 12:17 PM
OMG! Thank you so much for the detailed instructions! It took several tries because I was using different columns and had to change the directions to fit my labels, but it worked! Then I fixed all the green boxes and moved the decimal (which added zeros where necessary). I now have a column of numbers with two decimal places and they sort perfectly. Thank you, thank you, thank you from the bottom of my heart.