I need to sort a list of part numbers alphanumerically. Excel will not sort them correctly though when I open the auto filter drop down it shows them in the order that I need.
They aren't uniform in length, some contain letters, some have leading zeros, with a maximum length of 15 characters. Here is a list along with the correct sorting:
Part Correct Sort
00863 00863
1123 02257
02257 07706
6549 10338
6834 11212
07706 1123
8001 65412SSCY
8001 6549
10338 6834
11212 8001
65412SSCY 8001
EN93 EN93
SCSM11BE SCSM11BE
Hoping for a macro or method.
If you have values formatted as Text and not numbers with custom number formats (for leading zeroes) then all you need to do is choose the correct Sort Warning option.
If you opt for *Sort numbers and numbers stored as text separately, you will come up with teh correct (as per your sample) sort order.
Note that text by default is left-aligned in a cell while numbers (regardless of their number formatting) are right-aligned by default.
You need to specify the correct option to Excel:
and after the sort:
Select the column with the original data and then click on "Text to Columns".
Pick Delimited as the file type, and then click "Next".
Uncheck all the delimiters and then click "Next".
On the Step 3 of 3 window, choose Text as the Column data format.
Then click Finish.
All your data will now act as type = text.
Then select all the data again, and in the sort you can choose "Sort numbers and numbers stored as text separately"
Related
I have data in notepad with more than 1000+ entries, which need to convert in to Excel with particular break based on length. can someone help
011000015FRB-BOS FEDERAL RESERVE BANK OF BOSTON MABOSTON Y Y20040910
File format is as below
Position Field
1-9 Routing number
1 Office code
I tried delimiting option but dint worked out.
If your data always has the routing number in columns 1-9, then delimited import is the way to go. Choose Import From Text, then select Fixed Width and click Next. On Step 2, click at each character that would be a separator. Eg, click at character 9 to split it into two columns with the first column haviong the first nine characters and the second column having the rest. Step 3 will allow you to set the data format. I'd recommend setting the first column to text so Excel doesn't try to use scientific notation or something on your account numbers.
For example I have this line right here:
-2.7769,-5.6967,5.9179,0.37671,1
When I convert text to column using as delimiter comma in preview I see the result just right:
-2.7769 -5.6967 5.9179 0.37671 1
But when I press confirm I get this:
-27.769 -56.967 59.179 0.37671 1
How can I stop it from doing that and get the desired outcome?
I tried to make a line separated with commas into columns using the text to column feature from excel but I didn't get the result I was hoping for.
I don't know the entire solution, but I clearly see that you are mixing up decimal delimiter and thousand delimiter:
I guess that you mean "-2.7769" meaning "minus two, followed by a decimal separator, followed by .7769 (a number between zero and one)", but what your computer understand is: "minus twenty-seven thousand, seven hundred and sixty-nine, but the user has put the thousand separator at the wrong place. I will correct this."
In order to check whether or not your Excel is using a thousand separator, you can ask a random cell's formatting (right-click, choose "Format cells"): the "Use 1000 Separator (,)" checkbox in the "Number" chapter should be unchecked, as in this screenshot:
I am trying to enter approximately 190 txt datafiles in Excel using the New Query tool (Data->New Query->From File->From Folder). In the Windows explorer the data are properly ordered: the first being 0summary, the second 30summary etc.
However, when entering them through the query tool the files are sorted as shown in the picture (see line 9 for example, you will see that the file is not in the right position):
The files are sorted based on the first digit instead of the value represented. Is there a solution to this issue? I have tried putting space between the number and the summary but it also didn't work. I saw online that Excel doesn't recognize the text within "" or after /, but I am not allowed to save the text files with those symbols in their name in Windows. Even when removed the word summary the problem didn't fix. Any suggestions?
If all your names include the word Summary:
You can add a column "Extract" / "Text before delimiter" enter "Summary", change the column type to Number and sort over that column
If the only numbers are those you wish to sort on, you can
add a custom column with just the numbers
Change the data type to whole number
sort on that.
The formula for the custom column:
Text.Select([Name],{"0".."9"})
If the alpha portion varies, and you need to sort on that also, you can do something similar adding another column for the alpha portion, and sorting on that.
If there might be digits after the leading digits upon which you want to sort, then use the following formula for the added column which will extract only the digits at the beginning of the file name:
=Text.Middle([Name],0,Text.PositionOfAny([Name],{"A".."z"}))
I have data like this on column A
When I'm going to sort column a by Value (A-Z) It's Sort like below
But I want to Sort this Column By
1-MBM Admission Test-2010 (14th Batch)-175.csv
2-MBM Admission Test 2012 (16th Batch)-172.csv
3-MBM Admission Test 2011 (15th Batch)-174.csv
How Can I do this? I have searched many solution but none of it worked!
You need to understand that text sorts different to numbers. If you have text that starts with a number, it will still sort as text. And for text sort, the order is 1,11,19,2,20 etc.That means, text is sorted strictly by each character after the other. The first sort will be for the first character, so all items with a 1 as the first character come first. Then the next character is evaluated. A "-" sign will be sorted after any number, so the "1-" comes after the "10" and even after the "19".
To achieve the sort order you describe you will need to change the text and pad the numbers with leading zeroes, like
001-Some text
002-Some text
010-Some text
100-Some Text
right click the 1st row of the column then hover over "filter" select "Filter by selected cell value" then click drop down and tadaaa ...Sort in Order...
I have set up an advanced filter in Excel. I can not get the advanced filter to produce any output when using wildcard asterisks (*), using a source list that contains numbers and hyphenated numbers, OR alternatively when using a separate list which is producing a number from a formula. All adv.filter headers are properly placed and named; the filter works fine not using wildcards.
Original List:
10
10-1
11
11-1
100
I am using a formula to convert these hyphenated numbers to ignore the dashes so they will sort properly (smallest to largest) in my list:
=IF(A1="","",IFERROR(VALUE(LEFT(A1,FIND("-",A1)-1)),VALUE(A1)))
This results in a secondary column (which is the advanced filter source data):
10
10
11
11
100
My advanced filter criteria then becomes *10* with wildcards, with the output header being the original list with dashes included. I am expecting the wildcard to show both 10 and 100 in the output when user types in 10. There is no output data, however, when using the wildcard. There is exact match output data when I just type in 10 with no asterisks.
Any ideas for why wildcards aren't working? I tried formatting the source data and criteria data as both text, number, and general; none made any difference with wildcards. Thanks for the help!!!!
You had the right idea when you tried formatting as text: wildcards don't work on numeric values.
Where you're running into trouble is that formatting as text doesn't change numbers to text retroactively; only numbers entered after the format change get converted. Instead convert your data to strings first using the TEXT function in another location, and then filter that result.
Depending on exactly what you're doing with the VALUE function in your formula, you might even be able to use TEXT in there.