Formula for finding value in single row and then returning the value of the cell 2 to the left in the same row

newnova

New Member
Joined
Feb 21, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I can't seem to figure out how to make VLOOKUP or HLOOKUP work in this circumstance: to find a value and return a related value from the same array (a single row).

Example:
Product Code1Location1Quantity1Product Code2Location2Quantity2Product Code3Location3Quantity3Product Code4Location4Quantity4
BANAN1Aisle 135BANAN2Aisle 1010BANAN3Aisle 2020BANAN4
Aisle 3​
21

I want to write 3 separate formulas that find the highest quantity in a single row (which I have done via index match max), but also that pull the product code and location code which correspond with that highest quantity from the same row. So that I can add three columns to the end of the row with Best Product Code, Best Location, Best Quantity. In the above example, Best product code should be BANAN4, Best Location should be Aisle 3 and Best Quantity (which I've already figured out) should be 21.

Does anyone know if I'm on the right track using HLOOKUP and VLOOKUP or if I should be approaching this problem differently altogether?
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Hi & welcome to MrExcel.
How about
+Fluff 1.xlsm
ABCDEFGHIJKLMNOP
1Product Code1Location1Quantity1Product Code2Location2Quantity2Product Code3Location3Quantity3Product Code4Location4Quantity4
2BANAN1Aisle 135BANAN2Aisle 1010BANAN3Aisle 2020BANAN4Aisle 321BANAN4Aisle 321
Primary
Cell Formulas
RangeFormula
N2:P2N2=INDEX(A2:L2,MATCH(MAX(A2:L2),C2:L2,0)+{0,1,2})
Dynamic array formulas.
 
Upvote 0
Maybe this,

Book1
ABCDEFGHIJKL
1Product Code1Location1Quantity1Product Code2Location2Quantity2Product Code3Location3Quantity3Product Code4Location4Quantity4
2BANAN1Aisle 135BANAN2Aisle 1010BANAN3Aisle 2020BANAN4Aisle 321
3
4
5Best ProductBANAN4
6Best LocationAisle 3
7Best Qty21
Sheet1
Cell Formulas
RangeFormula
B5B5=INDEX(Product,MATCH(MAX(Product),Product,0)-2)
B6B6=INDEX(Product,MATCH(MAX(Product),Product,0)-1)
B7B7=INDEX(Product,MATCH(MAX(Product),Product,0))
Named Ranges
NameRefers ToCells
Product=Sheet1!$A$2:INDEX(Sheet1!$2:$2,1,COUNTA(Sheet1!$2:$2))B5:B7
 
Upvote 0

Forum statistics

Threads
1,214,786
Messages
6,121,548
Members
449,038
Latest member
Guest1337

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