Index Match for a 2D array, but with a twist.

mister_m

New Member
Joined
Sep 16, 2023
Messages
11
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Hello. I'm new here and thankful for the quick registration.
I've come up with an interesting challenge while trying to solve this issue at work.

Attached image for reference.

I have two inputs (let's say in cells M4 and M5). M4: required ratio
M5: required torque.
I have a matrix C3 to H8. This matrix has torques in incremental order horizontally.
Row 2 contains model names of gearboxes. (C2 to H2)

I need to find the closest match for gear ratio in column B. Then, the next highest value for torque, corresponding to that ratio. Then, the model name for that torque from the row C2 to H2.

This seemed fairly simple using INDEX MATCH but got insanely complicated due to the required criteria.
Let me know if you need additional information.
 

Attachments

  • IMG_20230916_124616.jpg
    IMG_20230916_124616.jpg
    71.7 KB · Views: 13
W
Ah. Sure, will do.
But do you mean, it's working for you?

Yes, it was fine (O365). I'm on the verge of abandoning Mr Excel, as I simply can't get the file uploader to work... no matter what I do.
I tried it and it worked!!
You made my day! Thank you very much.
Would you explaining how this formula works? Especially when he aggregate, and the frequency function?
 
Upvote 0

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.
What if the gear ratio is 30? Both 28 and 32 are exactly the same distance away. Which should be used and why?
In such cases, we prefer the one with lower gear ratio.
The reason is that lower gear ratio would mean we get higher output speed after reduction. This can be brought down to desired value using other simple methods like a VFD.
If we had chosen the one with higher gear ratio, the output rotation speed would itself be low. And this would have to be increased somehow to reach the desired value. (The required ratios are calculated based on maximum speed of the motor.)
 
Upvote 0
So, wouldn't this considerably shorter one do the same job?
=INDEX(C2:H2,MATCH(TRUE,INDEX(C3:H8,MATCH(B14,B3:B8),0)>=B15,0))
 
Upvote 0
So, wouldn't this considerably shorter one do the same job?
=INDEX(C2:H2,MATCH(TRUE,INDEX(C3:H8,MATCH(B14,B3:B8),0)>=B15,0))
I had tried to do something similar but had struggle entering the 'array' parameter for the row since it is variable.

As to the one you posted, it is still finding the next lowest even if the required value is extremely close to the next highest.
Closest match is the first priority.
 
Upvote 0
Closest match is the first priority.
Ah, yes I forgot about that, sorry. Try this.
Excel Formula:
=INDEX(C2:H2,MATCH(TRUE,INDEX(C3:H8,MATCH(MIN(ABS(B14-B3:B8)),ABS(B14-B3:B8),0),0)>=B15,0))
 
Upvote 0
Ah, yes I forgot about that, sorry. Try this.
Excel Formula:
=INDEX(C2:H2,MATCH(TRUE,INDEX(C3:H8,MATCH(MIN(ABS(B14-B3:B8)),ABS(B14-B3:B8),0),0)>=B15,0))
Will give it a try and let you know.
 
Upvote 0
Hi there !
Thanks for your various answers !
I am having the same type of issue, but with multiple criteria
Objective: retrieve the name of the state (row D16:AC16), that has the maximum/highest value (found in C20:AC120) from a selected criteria (A6 to A10 per ex), selected within column A (A19:A124).
The search thus goes horizontally/vertically/left/right
Any idea of how it could be solved ?
Thanks a lot in advance !
Cheers

NB: I tried these, but I failed somehow :P :
=XLOOKUP(($A$20:$A$124=A6)*(MAX(IF($A$20:$A$124=A6;$C$20:$AC$124));$C$16:$AC$16))
=INDEX($C$16:$AC$16;MATCH(MAXIFS($C$19:$AC$124;$A$19:$A$124;A6);$C$19:$AC$124;0))
=INDEX($C$16:$AC$16;MATCH(MAX(IF($A$19:$A$124=A6;$C$19:$AC$124));$C$19:$AC$124;0))
=INDEX($C$16:$AC$16;MATCH(MAX(IF($A$19:$A$124=A7;$C$19:$AC$124));$C$19:$AC$124;0))
=INDEX($16:$16;AGGREGATE(15;6;COLUMN($C$16:$AC$16)/(INDEX($C$20:$AC$124;MATCH(LOOKUP(0;0/FREQUENCY(0;ABS($A$20:$A$124-A6));$A$20:$A$124);$A$20:$A$124;0)=INDEX($AD$20:$AD$124;MATCH(A6;$A$20:$A$124;0));1))))
=INDEX($14:$14;AGGREGATE(15;6;COLUMN($C$14:$AC$14)/(INDEX($C$20:$AC$124;MATCH(LOOKUP(0;0/FREQUENCY(0;ABS($A$20:$A$124-A6));$A$20:$A$124);$A$20:$A$124;0)=E6;1))))


INDEX MATCH MAXIFS_Multiple criteria.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAG
2How could I retrieve the state with the highest values of the below criteria (D6 to D10), all at once, without adding columns AD and following ?
3
4
5Highest value INDEX MATCH State INDEX MATCH All at once formula ? :)
6Surfaces agricoles en %56FR
7Surfaces boisées en %51TI
8par km²5 300BS
9selon le Code pénal (CP)109BS
10selon la Loi sur les stupéfiants et les produits psychotropes (LStup)18BS
11
12
13
14RAW DATAADDED COLUMNS
15
16Choix d'indicateurs en comparaison régionale, 2021Année Suisse ZHBELUURSZOWNWGLZGFRSOBSBLSHARAISGGRAGTGTIVDVSNEGEJUMAX Related stateMINRelated state
17
18
19Population
20Habitants en milliers20198 606.01 539.31 039.5413.136.7160.537.943.140.6127.6321.8275.2195.8289.582.355.416.1510.7199.0685.8279.5351.5805.1345.5176.5504.173.61 539 ZH 16AI
21Variation en %2010-20199.412.16.19.43.69.46.65.05.112.915.57.85.95.57.84.62.86.63.312.212.55.312.910.52.610.15.116 FR 3NE
22par km²2019215.2926.8178.0289.134.7188.578.9178.559.6616.2202.0348.25 300.2559.2276.2228.393.5261.828.0491.6323.9128.2285.466.3246.32 050.887.85 300 BS 28GR
23Répartition par âge en %2019- N/A, nfwd -N/A, nfwd
240–1920.019.819.020.320.019.320.018.119.220.322.219.017.319.218.720.221.120.517.820.220.318.021.919.621.021.020.822 FR 17BS
2520–6461.463.259.961.959.262.660.761.060.562.461.861.162.958.759.959.959.361.060.561.861.859.161.560.559.862.557.963 ZH 58JU
2665 ou plus18.717.021.117.820.818.219.320.920.417.316.019.919.822.221.419.919.618.521.717.917.923.016.619.919.316.421.323 TI 16FR
27Population urbaine en % 1)201984.899.374.763.988.682.127.650.576.7100.074.885.9100.097.689.776.60.082.444.985.067.092.889.678.987.8100.053.7100 ZG -AI
28Etrangers en %201925.327.116.618.812.621.914.714.824.228.322.822.936.623.126.116.511.324.418.825.325.227.633.022.625.340.014.740 GE 11AI
29Mouvement de la population (en ‰)2019- N/A, nfwd -N/A, nfwd
30Taux brut de nuptialité4.55.24.44.84.84.65.04.34.34.94.24.64.94.44.95.04.95.04.34.74.93.43.94.23.64.33.75 ZH 3TI
31Taux brut de divortialité2.02.01.91.61.31.91.42.11.41.92.01.82.01.82.02.01.01.91.72.01.92.12.12.12.22.32.32 JU 1AI
32Taux brut de natalité10.010.89.610.69.49.69.28.910.210.410.99.510.58.88.810.110.810.38.210.310.47.110.79.19.510.79.611 FR 7TI
33Taux brut de mortalité7.97.49.37.58.46.97.47.810.36.26.68.410.68.69.88.78.37.98.87.37.59.26.88.49.06.79.111 BS 6ZG
34Ménages privés en milliers20193 81169247517915691619185513412397129382472239229712216435415382203323 811 N/A, nfwd 7AI
35Taille moyenne des ménages en personnes20192.22.22.12.32.32.32.32.22.22.32.42.21.92.22.12.32.42.32.12.32.32.12.22.22.12.42.22 AI 2BS
36- N/A, nfwd -N/A, nfwd
37Langue principale en % 2) 3)2019- N/A, nfwd -N/A, nfwd
38Allemand62.780.783.788.693.488.392.090.686.580.326.187.176.886.286.890.894.987.775.286.489.110.25.524.64.74.07.495 AI 4GE
39Français22.83.311.01.6X1.9(1.5)(1.6)(1.2)3.469.02.95.03.2(1.8)(1.1)X1.31.32.01.34.782.667.887.779.689.890 JU 1AR
40Italien8.35.63.13.3(1.4)3.5(1.2)(3.2)5.54.32.44.86.15.53.9(2.3)(1.5)3.513.25.13.788.65.04.65.76.42.589 TI 1OW
41Romanche0.50.3(0.1)(0.2)X(0.3)(0.6)X(0.6)(0.2)(0.1)(0.2)(0.2)(0.1)XXX(0.4)14.7(0.1)(0.1)(0.1)(0.0)XX(0.1)X15 GR 0VD
42Anglais6.59.54.44.6(3.3)6.3(3.5)5.4(4.0)12.13.94.312.16.75.24.6(3.3)4.13.45.53.93.98.93.84.612.2(2.3)12 GE 2JU
Data OFS
Cell Formulas
RangeFormula
B6:B10B6=INDEX($AD$20:$AD$124,MATCH(A6,$A$20:$A$124,0))
C6:C10C6=INDEX($AE$20:$AE$124,MATCH(A6,$A$20:$A$124,0))
AD20AD20=MAX(D20:AC20)
AE20:AE42AE20=IFERROR(INDEX($D$16:$AC$16,MATCH(AD20,D20:AC20,0)),"N/A, nfwd")
AF20:AF42AF20=MIN(C20:AC20)
AG20:AG42AG20=IFERROR(INDEX($D$16:$AC$16,MATCH(AF20,D20:AC20,0)),"N/A, nfwd")
AD21:AD42AD21=MAX(C21:AC21)
 
Upvote 0
Please start a thread of your own for this question & stop posting it to multiple old threads.

Also I suggest that you update your Account details (or 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’)
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,956
Members
449,096
Latest member
Anshu121

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