Find closest match in a horizontal

edtwiest

New Member
Joined
Sep 1, 2010
Messages
31
Office Version
  1. 365
Platform
  1. Windows
I have items with a current value and now we have done some calculations en the new results are columns E-L

If i want to have the nearest match to item 1-002, the nearest match should be 150 [closer to 167,39 then 207]

I've tried to do index and match with multiple criteria, but all i got was errors.
Maybe some kind of matrix-formule??

I hope some wizzkid overhere is able to help me out.

Thanks in advance, Edwin
1646123323793.png
 

Attachments

  • 1646123219673.png
    1646123219673.png
    18.4 KB · Views: 4

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Two things would help:
  • Update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
  • Investigate XL2BB for providing sample data to make it easier for helpers by not having to manually type out sample data to test with.
 
Upvote 0
horizontal lookup closest match.xlsx
ABCDEFGHIJKL
1itemnocurrent valueW-valueitemnow1w2w3w4w5w6w7
21-002167,391-00295739192207150305
312-00116,5313-0022441841386711385
42-305240,761-0031915747766411113
54-225452,591-01012344692354641
61-010103,3312-0011421401446107551
71-00323,772-002403161240263152207188
82-002290,362-30531433013715115595228
913-00237,24-225375590559518528369550
Blad1
 
Upvote 0
Thanks for addressing both issues. (y)

Not sure why you marked 51 in green when 10 is much closer?
Try this.

22 03 01.xlsm
ABCDEFGHIJKL
1itemnocurrent valueW-valueitemnow1w2w3w4w5w6w7
21-002167.391501-00295739192207150305
312-00116.531013-0022441841386711385
42-305240.762281-0031915747766411113
54-225452.595181-01012344692354641
61-010103.336912-0011421401446107551
71-00323.77192-002403161240263152207188
82-002290.362632-30531433013715115595228
913-00237.2244-225375590559518528369550
Closest
Cell Formulas
RangeFormula
C2:C9C2=INDEX(F$2:L$9,MATCH(A2,E$2:E$9,0),MATCH(MIN(ABS(INDEX(F$2:L$9,MATCH(A2,E$2:E$9,0),0)-B2)),ABS(INDEX(F$2:L$9,MATCH(A2,E$2:E$9,0),0)-B2),0))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Last edited:
Upvote 0
Hi,

same answer, same question, other possible solution
Book1
ABCDEFGHIJKL
1itemnocurrent valueW-valueitemnow1w2w3w4w5w6w7
21-002167,391501-00295739192207150305
312-00116,531013-0022441841386711385
42-305240,762281-0031915747766411113
54-225452,595181-01012344692354641
61-010103,336912-0011421401446107551
71-00323,77192-002403161240263152207188
82-002290,362632-30531433013715115595228
913-00237,2244-225375590559518528369550
Sheet1
Cell Formulas
RangeFormula
C2:C9C2=LET(i,INDEX($F$2:$L$9,MATCH($A2,$E$2:$E$9,0),0),j,ABS(i-B2),INDEX(i,MATCH(MIN(j),ABS(j),0)))
 
Upvote 0
Always useful to have an O365 solution aswell!
In that case I would make the further saving of using FILTER instead of (one) INDEX/MATCH
(I have assumed values in column E do not repeat)

22 03 01.xlsm
ABCDEFGHIJKL
1itemnocurrent valueW-valueitemnow1w2w3w4w5w6w7
21-002167.391501-00295739192207150305
312-00116.531013-0022441841386711385
42-305240.762281-0031915747766411113
54-225452.595181-01012344692354641
61-010103.336912-0011421401446107551
71-00323.77192-002403161240263152207188
82-002290.362632-30531433013715115595228
913-00237.2244-225375590559518528369550
Closest (2)
Cell Formulas
RangeFormula
C2:C9C2=LET(f,FILTER(F$2:L$9,E$2:E$9=A2),a,ABS(f-B2),INDEX(f,MATCH(MIN(a),a,0)))
 
Upvote 0
@edtwiest
I was just wondering about an example like this. What result(s) would you want - assuming such data was possible?

22 03 01.xlsm
ABCDEFGHIJKL
1itemnocurrent valueW-valueitemnow1w2w3w4w5w6w7
21-0022001-002952109192220190305
Closest (3)
 
Upvote 0
Hi,

same answer, same question, other possible solution
Book1
ABCDEFGHIJKL
1itemnocurrent valueW-valueitemnow1w2w3w4w5w6w7
21-002167,391501-00295739192207150305
312-00116,531013-0022441841386711385
42-305240,762281-0031915747766411113
54-225452,595181-01012344692354641
61-010103,336912-0011421401446107551
71-00323,77192-002403161240263152207188
82-002290,362632-30531433013715115595228
913-00237,2244-225375590559518528369550
Sheet1
Cell Formulas
RangeFormula
C2:C9C2=LET(i,INDEX($F$2:$L$9,MATCH($A2,$E$2:$E$9,0),0),j,ABS(i-B2),INDEX(i,MATCH(MIN(j),ABS(j),0)))

@edtwiest
I was just wondering about an example like this. What result(s) would you want - assuming such data was possible?

22 03 01.xlsm
ABCDEFGHIJKL
1itemnocurrent valueW-valueitemnow1w2w3w4w5w6w7
21-0022001-002952109192220190305
Closest (3)
Hi Peter, in that case i'd like to have 210 as a result, but mostly your formule (2016) should be fine.... unless there is an easy way for you to adjust that first formula...
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

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