top of page

You can use the below vba code, posted here, to sort data on an Excel worksheet by rows instead of columns.

As currently written, this macro will sort from row 2 to the end. To clear, in this example, what happens is it sorts the entries in each row from 2 to 4, so the data in B2 through D2 is in alpha order from left to right; then from B3 through D3 from left to right; and so on.

We begin with:

. . . and get:

Sub sortrows()

Dim i As Long Dim lr As Long

lr = Range("A" & Rows.Count).End(xlUp).Row For i = 2 To lr Range("B" & i, "D" & i).Sort Key1:=Range("B" & i), _ Order1:=xlAscending, _ Header:=xlNo, _ OrderCustom:=1, _ MatchCase:=False, _ Orientation:=xlLeftToRight, _ DataOption1:=xlSortNormal Next i

End Sub


 
 

Sometimes when running a complex formula in Excel for a lot of data, you'll get an error message indicating that Excel ran of resources.

If this happens, note that you can improve the performance of Excel and possibly successfully run the formula for your full data set by increasing the number of threads that Excel is using.

Computers use schedulers to assign resources to complete tasks. The smallest sets of instructions that the scheduler can manage is a thread, but a process - the instance of a program - can use multiple threads.

In order to confirm that you're getting as much juice out of Excel as your computer can give, increase the thread settings. Go to File . . . Options . . . Advanced . . . and scroll down to the Formulas section. Here you can set a specific number of threads or simply select the radial button that uses all available processors.


 
 

Don't miss that Excel's EXACT function is an easy way to tell if the data in two cells matches.

It's case sensitive but will not detect differences in formatting. A TRUE result is given if the cells match, a FALSE result if not.

It's more useful to use in conjunction with another formula. VLOOKUP is not case sensitive, but you can nest EXACT in a LOOKUP formula to do a case sensitive search.


 
 

Sean O'Shea has more than 20 years of experience in the litigation support field with major law firms in New York and San Francisco.   He is an ACEDS Certified eDiscovery Specialist and a Relativity Certified Administrator.

The views expressed in this blog are those of the owner and do not reflect the views or opinions of the owner’s employer.

If you have a question or comment about this blog, please make a submission using the form to the right. 

Your details were sent successfully!

© 2015 by Sean O'Shea . Proudly created with Wix.com

bottom of page