Finding the three lowest scores

spydey

Active Member
Joined
Sep 19, 2017
Messages
314
Office Version
  1. 2013
Platform
  1. Windows
So I have, what I think, is a somewhat complicated scenario that I need to solve. I have bits and pieces but can't seem to get it to all come together in to the end result I am seeking.

I have a single workbook.
Two worksheets.

Sheet 1:
ItemNames in column A and Locations in column B.
There are 80+ unique ItemNames, and 53 unique Locations.
The ItemNames starts in A3 and the Locations start in B3
Row 2 contains the column headers.

Sheet 2:
ItemNames in column A and Locations in column B.
There are 80+ unique ItemNames, and 53 unique Locations.
They are not all in the same order as Sheet 1.
The ItemNames starts in A3 and the Locations start in B3
Row 2 contains the column headers.
Columns I through Q contains numerical data for each combination of ItemName and Location.

I hope that helps to some degree.

I need to do the following:

Give me the headers of the columns that contain the 3 lowest values for each ItemName & Location combination.

Example: In sheet 1, cell D3:F3, I need the names of the columns from Sheet 2 that contain the lowest values for the same ItemName & Location combo as found in Sheet 1 Cells A3 & B3.

I have used the following, in sheet 1 cell D3, before to get the headers of the columns that contain the lowest value:

Code:
=INDEX(Sheet2!$I$2:$Q$2,0,MATCH(SMALL(Sheet2!$I3:$Q3,COLUMNS($D$3:D3)),Sheet2!$I3:$Q3,0))

I then fill this over through F3.

But I have two issues with using this:

1. It doesn't allow me to get the data for the same ItemNames & Location combo as in Sheet1. The ItemNames & Locations from sheet1 may not be in the same order as sheet2. I was thinking of using an Index(Match, as I have for other things, but am not sure how to incorporate it to use the above formula.

2. If any of the 3 lowest values are the same, then I get the same header, the first one in the series, for any of the same values, even though the headers are all different. Example: values of 0, 2, 0. My headers would return as Header1, Header2, & Header1; when it should be Header1, Header2, Header3.

Hopefully that all makes sense!! I am a little confused myself, so I hope I didn't pass that on in my writeup! hahahaha

Thanks as always.

-Spydey

So in essence I guess it would be a formula whose output would be this:

Give me the unique column headers of the 3 lowest values from Sheet2 where ItemName & Location match the ItemName & Location from Sheet 1. The results would be placed in Sheet 1.
 
Last edited:
The pipe is used to make sure we don't get false matches, like:

anneliason
anneliason

<tbody>
</tbody>


Rare, true, but it happens. Depends on the data too. If you combine numbers with text, it's not really necessary, but it's a good habit to get into.

And yes, your proposed alternate snippet should work the same. I haven't tested it, but I'd guess they both are roughly equal in efficiency.
 
Upvote 0

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Perfect. Thanks for the quick and easy to follow explanation.

Take care!

-Spydey
 
Upvote 0

Forum statistics

Threads
1,214,998
Messages
6,122,639
Members
449,093
Latest member
Ahmad123098

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