Macro To Sort Data Required

Older Excel Learner

New Member
Joined
Feb 3, 2018
Messages
12
[TABLE="class: outer_border, width: 1000, align: center"]
<tbody>[TR]
[TD][TABLE="width: 900"]
<colgroup><col span="12"></colgroup><tbody>[TR]
[TD]BEFORE[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD] [/TD]
[TD]Col A[/TD]
[TD]Col B[/TD]
[TD]Col C[/TD]
[TD]Col D[/TD]
[TD]Col E[/TD]
[TD]Col F[/TD]
[TD]Col G[/TD]
[TD]Col H[/TD]
[TD]Col I[/TD]
[TD]Col J[/TD]
[TD]Col K[/TD]
[/TR]
[TR]
[TD]Row 9[/TD]
[TD] [/TD]
[TD] [/TD]
[TD]12.1[/TD]
[TD]33.2[/TD]
[TD]0.3[/TD]
[TD]0.4[/TD]
[TD]14.5[/TD]
[TD]25.6[/TD]
[TD]17.7[/TD]
[TD]0.8[/TD]
[TD]0.9[/TD]
[/TR]
[TR]
[TD]Row 10[/TD]
[TD] [/TD]
[TD] [/TD]
[TD]41.1[/TD]
[TD]33.2[/TD]
[TD]33.3[/TD]
[TD]25.4[/TD]
[TD]29.5[/TD]
[TD]38.6[/TD]
[TD]17.7[/TD]
[TD]33.8[/TD]
[TD]0.9[/TD]
[/TR]
[TR]
[TD]Row 11[/TD]
[TD] [/TD]
[TD] [/TD]
[TD]Blank[/TD]
[TD]Blank[/TD]
[TD]Blank[/TD]
[TD]Blank[/TD]
[TD]Blank[/TD]
[TD]Blank[/TD]
[TD]Blank[/TD]
[TD]Blank[/TD]
[TD]Blank[/TD]
[/TR]
[TR]
[TD]Row 12[/TD]
[TD] [/TD]
[TD] [/TD]
[TD]Blank[/TD]
[TD]Blank[/TD]
[TD]Blank[/TD]
[TD]Blank[/TD]
[TD]Blank[/TD]
[TD]Blank[/TD]
[TD]Blank[/TD]
[T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row 14[/TD]
[TD] [/TD]
[TD] [/TD]
[TD]50.1[/TD]
[TD]33.8[/TD]
[TD]33.6[/TD]
[TD]33.4[/TD]
[TD]25.7[/TD]
[TD]25.5[/TD]
[TD]0.9[/TD]
[TD]0.3[/TD]
[TD]Blank[/TD]
[/TR]
[TR]
[TD]Row 15[/TD]
[TD] [/TD]
[TD] [/TD]
[TD]0.5[/TD]
[TD]0.4[/TD]
[TD]0.3[/TD]
[TD]0.1[/TD]
[TD]Blank[/TD]
[TD]Blank[/TD]
[TD]Blank[/TD]
[TD]Blank[/TD]
[TD]Blank[/TD]
[/TR]
[TR]
[TD]Row 16[/TD]
[TD] [/TD]
[TD] [/TD]
[TD]0.5[/TD]
[TD]0.4[/TD]
[TD]0.3[/TD]
[TD]0.1[/TD]
[TD]Blank[/TD]
[TD]Blank[/TD]
[TD]Blank[/TD]
[TD]Blank[/TD]
[TD]Blank[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

Hello All, I am new to Excel and have hit a problem that I require help with. I have tried Custom Sort within Excel but it does not do what I require.

The figures above represent two seperate/different numbers within the same cell each seperated by a . (full stop)

The first number before the . represents an individuals score (always between 0 and 100 inclusive)

The second number after the . represents a number assigned to an individual (currently 9 of us golfers)

The data range is C9:K302 . Each row has no bearing to any other row, so the sorting should begin in C9:K9, then start again in C10:K10 and so on down to the last row C302:K302

The data should be sorted by the numbers BEFORE the full stop , going from left to right, by highest, then zeroes, then blanks as above example.

It doesn't really matter if 2 players have the same score and it puts 33.2 in the cell before 33.1 or if it sorts 0.1 after 0.5, it would be nice if it went from player 1 to player 9, but highest then zeroes, then blanks in any player sequence will suffice.

All cells have formulas in them importing the data from another workbook, all have the same Conditional formatting and all are classified as General cells.

Thanks in advance for any help forthcoming.
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Is it anything to do with 100 being a 3 digit number I wonder.

Not if they're actually numbers. Text with numbers on the other hand can sort inconsistently (try sorting the cells containing the text Row 9, Row 10, Row 11 to see). Text will also have a higher sort value than numbers, and blanks will be last in either direction.
 
Last edited:
Upvote 0
Col C Col D Col E Col F Col G Col H Col I Col J Col K Col L

Row 9 7.1 20.2 64.3 40.4 1.5 10.6 100.7 Blank 0.9 9.10 Data Before running macro


Row 9 100.7 64.3 40.4 20.2 10.6 9.10 7.1 1.5 0.9 Blank Required after running macro


Hi sheetspread, thanks for sticking with me, when single digit scores are in a cell in the range, they cause a further problem by being ranked ahead of double digit numbers with the 100 being placed last just ahead of zero and blank using the current macro.

Could you please have a fresh look using the data above and see if you could come up with a new macro to try and solve it or even get close to above

My cells are GENERAL format and can't be NUMBER format as then when a tenth player as above is added the 2 decimal places will make player 1 become player 10 also.

The data still starts in C9 but above has 10 players instead of old macro accounting for 9, so the Range end is now L302

Thank you so much.
 
Upvote 0
They sorted fine in my test, with the general format, what order are you getting? Are these numbers entered by you or downloaded from somewhere? Is the column width affecting the results? Is there any kind of text in the cell (including ="")?
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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