# Excel/6/17/14 Question

Question
QUESTION: Okay.  Sorry about the confusion.

A1      AA1 AB1   AC1 AD1   AE1 AF1   AG1 AH1   ...ZZ1
Name      3.7      -4   1       3
Name2      2.2   2.2      3

What I am trying to do is get the last 20 numbers excluding the blanks.  AA1 would be the last number entered.
I then need to put the last 20 in order with the lowest number of the last 20 in cell B1, 2nd lowest C1, etc.

For example:
A1      B1   C1   D1   E1   F1
Name      -4   1   3   3.7

Thanks,
Harold Buchanan

Example: 3.7 in cell AA2, blank in AB2, -4 in AC2, blank in AD2, 1 in AE2, blank in AF2, 3 in AG2.

In AA3, enter formula

=MIN(COUNTA(\$AA2:AA2),20)

then copy this formula to AA3:ZZ3.

In cell B3, enter formula

=MATCH(MAX(AA3:ZZ3),AA3:ZZ3,0)

In cell B2, enter formula

=IFERROR(SMALL(OFFSET(\$AA2:\$ZZ2,0,0,1,\$B3),COLUMN(B2)-1),"")

Cell B2 will display -4, which is the smallest number among the left-most non-blank 20 cells of AA2:ZZ2.
Copy the formula from B2 into C2, and it will display the SECOND smallest number in those cells.
Copy the formula to D2 to display the THIRD smallest number, etc etc.

---------- FOLLOW-UP ----------

QUESTION: Stuart, the formula works well, but it doesn't work for my situation.
I have a row of scores in A for player 1
I have a row of scores in B for player 2,etc.
Can these formulas all be done in one row so that I can get the latest 20 scores for a 100 players sorted lowest score for each player to the highest?
Sorry to be so dense, but I am in over my head!
Thanks.
Harold Buchanan

In Sheet1, range AA1:ZZ1, enter your numbers.

Example: 3.7 in cell AA1, blank in AB1, -4 in AC1, blank in AD1, 1 in AE1, blank in AF1, 3 in AG1.

In Sheet2, cell AA1, enter formula

=MIN(COUNTA(Sheet1!\$AA1:AA1),20)

then copy this formula to Sheet2, AA1:ZZ1.

In Sheet2, cell z1, enter formula

=MATCH(MAX(AA1:ZZ1),AA1:ZZ1,0)

In Sheet1, cell B1, enter formula

=IFERROR(SMALL(OFFSET(\$AA1:\$ZZ1,0,0,1,Sheet2!\$Z1),COLUMN(B1)-1),"")

Cell B1 will display -4, which is the smallest number among the left-most non-blank 20 cells of AA1:ZZ1.
Copy the formula from B1 into C1, and it will display the SECOND smallest number in those cells.
Copy the formula to D1 to display the THIRD smallest number, etc etc.

For multiple players, copy row 1 on Sheet1 down as many rows as needed; do likewise on Sheet2.
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

#### Stuart Resnick

##### Expertise

I can answer questions relating to MS Excel formulas, or to programming with vba (Visual Basic for Applications) in the Excel environment. Please follow the following guidelines: your question should focus on one specific issue you want to learn. It's beyond the scope of this free service for me to create entire projects or complex vba solutions for you from scratch. You should be able to do most of the work yourself, and come here when you need help with a specific point you're stuck on. ALWAYS include a simple, concrete example illustrating what you want to learn. Explain this example in detail in the text of your question (what data is in which cells of which sheets, etc). Be very precise about the results you want, using this sample to make the logic clear. Always keep these examples SIMPLE. Never e.g. use 18 worksheets in your example if using 2 or 3 will do. Never use ranges like AI567:BB865 if using a range like A1:B3 will do. Thanks.

##### Experience

As a consultant, I've designed Excel tools since the 90s, working for the Federal Reserve Bank, AT&T, and (currently) Gap Inc.

Education/Credentials
My only "education" comes from 2 decades of doing spreadsheet/programming work, with major SF Bay Area corporations such as AT&T, Federal Reserve Bank, and Gap Inc.