Exam Results Sorting

imaso001

New Member
Joined
Jan 3, 2022
Messages
1
Office Version
  1. 2019
Platform
  1. Windows
Hello all. I am stumped on how to sort exam results in order. I have exam results for several thousand users with 7 content areas. I need to sort each user by their lowest to highest score for each content area so I can establish a remedial training plan. Using the first row as an example, I need the data for the first user to have columns 2&3 followed by column 1&5, then 4&7, then 6. The data is separated into 7 columns. Any help is greatly appreciated! Thank you.

1641220314291.png
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Try this macro:
VBA Code:
Sub SortRows()
    Dim rng As Range, rRng As Range, rRow As Range, LastRow As Long, lastCol As Long
    LastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Set rng = Range("A1:G" & LastRow)
    lastCol = Cells(1, Columns.Count).End(xlToLeft).Column
    For Each rRow In rng.Rows
        Set rRng = Range(ActiveSheet.Cells(rRow.Row, rng.Column), ActiveSheet.Cells(rRow.Row, lastCol))
        With Sheets("Sheet1").Sort
            .SortFields.Clear
            .SortFields.Add Key:=rRng, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
            .SetRange rRng
            .Header = xlNo
            .MatchCase = False
            .Orientation = xlLeftToRight
            .SortMethod = xlPinYin
            .Apply
        End With
    Next
End Sub
The problem you will have is that the column headers in row 1 will no longer match the scores. I'm not sure how you want to handle that issue.
 
Upvote 0

Forum statistics

Threads
1,214,915
Messages
6,122,212
Members
449,074
Latest member
cancansova

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