Match 3 different values to MAX value of cell in list.

Weeble

Board Regular
Joined
Nov 30, 2016
Messages
95
Office Version
  1. 365
Hi!

So I have a table with description that look like this.

Description
255-146-130-1600
260-110-130-1600
260-115-130-1600
260-120-130-1600
260-135-130-1600
260-146-130-1600
260-160-150-1800

The digits represents values ' Length , Width, Height and Weight '

In a different sheet I have each value of a product written down in single cells.

LengthWidthHeightWeight
1401155106
12011380100
2561121201680

I this table I would like to add a column that matches the closest max value of the description.

LengthWidthHeightWeightDecription match
140 1155106255-146-130-1600
12011380100255-146-130-1600
2561121201680260-160-150-1800

The first two match with description ' 255-146-130-1600 ' due to all critiera fits in the match and takes the lowest length.
The last one matches with description ' 260-160-150-1800 ' Since length does not fit in '255' and weight is above '1600'.
Writing this is seams very complicated. But maybe somone here has a good idea of what I want to achieve, and might have done it before.
How do i match the closest MAX critieria with my Description list?
 
Thank you for the clarification. I encountered an issue when attempting to write a formula that would sequentially evaluate the priorities. The main problem is that potentially preferred options may be excluded by the first priority screening. For example, suppose the dimensions to be matched (in the Match Table) are:
240178054
And the table to select items from (the Selections Table) contains:
240-200-80-54
241-17-80-54
A sequential search for priority #1 (finding the closest match for Length) would identify all Selections having a length=240, consequently, the selection whose length=241 would be excluded, even though it is only 1 cm longer and all of its other parameters are exact matches. To overcome this issue, I propose considering both length and width at the same time and basing the "best match" criteria on area. We calculate the area (Length x Width) of the item in the Match Table and then find which options in the Selections Table would be best utilized (i.e., we compute the ratio of the required area of the Match item to the available area of the options in the Selection Table and then choose the options having the largest ratio). At the same time, the formula requires that the individual parameters of the Selection Table options are greater than or equal to the corresponding parameters of the Match item. To address situations where more than one item in the Selections Table satisfies all of these criteria (as is the case for (259,146,55,106) where 260-146-130-1600 and 260-146-150-1800 are both possibilities), the array of potential choices is fed into another test to identify which of them best matches the Height of the item in the Match Table...this serves as the tie-breaker. The Weight is not used for tie-breaking purposes, only for confirmation that the Selection Table item has a weight that is greater than or equal to the Match Table item.

The entire list you provided earlier is included in the working example below, with two exceptions. I inserted two hypothetical options in H80:H81 to test the match/selection of the yellow cells. Your original data for those two cells is shown in N80:N81...I'm not sure if there are issues with row 78 and others that have text. The orange cells reflect your most recent example: You will see that this approach finds a different solution for both of them. I also added in other examples to the Match Table drawn from earlier posts (light blue and dark blue). Please have a look at the matches found for these (green cells in column F) and determine whether this area ratio approach produces reasonable results, and let me know if something different should be done.

The Selections Table will be in a follow-up post...
MrExcel20200915.xlsx
ABCDEF
1Match Table
2undersize dim ratiosLxW area ratios
3sum all, take mintake max
4LengthWidthHeightWeightDescription matchDescription match
525914655106260-146-130-1600260-146-130-1600
612011380100130-305-85-800130-115-85-1050
72561121201680260-146-150-1800260-146-150-1800
82601601501850280-880-240-8000320-550-260-24900
92601101201850340-146-130-2200340-146-130-2200
102591131301600260-113-130-1600260-113-130-1600
112601121301600260-113-130-1600260-113-130-1600
12240178054.264440-40-126-1500260-60-130-1600
133601792188.7440-40-126-1500440-40-126-1500
1410044100260-18-30-100115-30-45-250
154401155106.24440-40-126-1500440-40-126-1500
1690011.5563316920-70-126-2000920-70-126-2000
172511790842.4440-40-126-1500260-60-130-1600
182511790842.4440-40-126-1500260-60-130-1600
192511790842.4440-40-126-1500260-60-130-1600
202511790842.4440-40-126-1500260-60-130-1600
212511790842.5440-40-126-1500260-60-130-1600
222511790842.4440-40-126-1500260-60-130-1600
232511790842.4440-40-126-1500260-60-130-1600
242511790842.4440-40-126-1500260-60-130-1600
252511790842.5440-40-126-1500260-60-130-1600
262511790842.5440-40-126-1500260-60-130-1600
272511790842.4440-40-126-1500260-60-130-1600
28240178054.264440-40-126-1500260-60-130-1600
293601792188.7440-40-126-1500440-40-126-1500
3024417.756130440-40-126-1500260-60-130-1600
314401880229.2440-40-126-1500440-40-126-1500
324401880229.2440-40-126-1500440-40-126-1500
33120018112.511781220-70-126-20001220-70-126-2000
34120308043130-60-85-800130-40-85-1050
351203080100130-60-85-800130-40-85-1050
36120318027130-60-85-800130-40-85-1050
371103210095130-80-120-1050130-80-120-1050
381103210095130-80-120-1050130-80-120-1050
3912032808.48130-60-85-800130-40-85-1050
Weeble
Cell Formulas
RangeFormula
E5:E39E5=IFERROR(INDEX($H$3:$H$105,AGGREGATE(15,6,(ROW($H$3:$H$105)-ROW($H$2))/(AGGREGATE(15,6,($J$3:$J$105/$A5-1)/($J$3:$J$105/$A5>=1)+($K$3:$K$105/$B5-1)/($K$3:$K$105/$B5>=1)+($L$3:$L$105/$C5-1)/($L$3:$L$105/$C5>=1)+($M$3:$M$105/$D5-1)/($M$3:$M$105/$D5>=1),1)=(($J$3:$J$105/$A5-1)/($J$3:$J$105/$A5>=1)+($K$3:$K$105/$B5-1)/($K$3:$K$105/$B5>=1)+($L$3:$L$105/$C5-1)/($L$3:$L$105/$C5>=1)+($M$3:$M$105/$D5-1)/($M$3:$M$105/$D5>=1))),1)),"no match")
F5:F39F5=IFERROR(INDEX($H$3:$H$105,AGGREGATE(15,6,(ROW($H$3:$H$105)-ROW($H$2))/(AGGREGATE(14,6,$C5/$L$3:$L$105/(AGGREGATE(14,6,($A5/$J$3:$J$105)*($B5/$K$3:$K$105)/(($A5/$J$3:$J$105<=1)*($B5/$K$3:$K$105<=1)*($C5/$L$3:$L$105<=1)*($D5/$M$3:$M$105<=1)),1)=($A5/$J$3:$J$105)*($B5/$K$3:$K$105)/(($A5/$J$3:$J$105<=1)*($B5/$K$3:$K$105<=1)*($C5/$L$3:$L$105<=1)*($D5/$M$3:$M$105<=1))),1) = $C5/$L$3:$L$105/(AGGREGATE(14,6,($A5/$J$3:$J$105)*($B5/$K$3:$K$105)/(($A5/$J$3:$J$105<=1)*($B5/$K$3:$K$105<=1)*($C5/$L$3:$L$105<=1)*($D5/$M$3:$M$105<=1)),1)=($A5/$J$3:$J$105)*($B5/$K$3:$K$105)/(($A5/$J$3:$J$105<=1)*($B5/$K$3:$K$105<=1)*($C5/$L$3:$L$105<=1)*($D5/$M$3:$M$105<=1)))),1) ),"no match")
 
Last edited:
Upvote 0

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
...and the Selections Table:
MrExcel20200915.xlsx
HIJKLMN
1Selections TableHelper Table
2DescriptionLWHWt
3255-146-130-16002551461301600
4260-110-130-16002601101301600
5260-115-130-16002601151301600
6260-120-130-16002601201301600
7260-135-130-16002601351301600
8260-146-130-16002601461301600
9260-146-150-18002601461501800
10260-305-150-18002603051501800
11260-60-130-1600260601301600
12260-80-130-1600260801301600
13260-85-130-1600260851301600
14260-95-130-1600260951301600
15#VÄRDEFEL!    
16340-105-130-16003401051301600
17340-146-130-16003401461301600
18340-146-130-22003401461302200
19340-85-130-2200340851302200
20340-87-130-1600340871301600
211300-550-300-1170001300550300117000
221450-550-500-97000145055050097000
231500-600-800-99999150060080099999
24250-550-140-1050025055014010500
25250-550-225-1650025055022516500
26270-335-85-6850270335856850
27300-550-130-1170030055013011700
28320-550-260-2490032055026024900
29420-450-130-1600042045013016000
30420-550-130-1600042055013016000
31450-550-300-4050045055030040500
32490-550-225-3300049055022533000
33520-550-300-4680052055030046800
34610-550-130-2350061055013023500
35620-550-240-4450062055024044500
36650-550-500-5000065055050050000
37820-550-240-5900082055024059000
38840-550-300-7500084055030075000
391220-70-126-20001220701262000
40440-100-126-15004401001261500
41440-40-126-1500440401261500
42440-50-126-1500440501261500
43440-60-126-1500440601261500
44440-80-126-1500440801261500
45440-90-126-1500440901261500
46500-360-130-45005003601304500
47620-70-126-1500620701261500
48920-70-126-2000920701262000
49140-25-75-2501402575250
5040-16-20-2540162025
5150-35-30-250503530250
5250-35-45-250503545250
5350-50-30-250505030250
5450-50-45-250505045250
5550-60-30-250506030250
5680-15-30-100801530100
5780-15-45-100801545100
5880-35-30-100803530100
5980-35-45-100803545100
6080-50-30-100805030100
6180-50-45-100805045100
62120-40-42-5001204042500
63130-110-85-1050130110851050
64130-115-85-1050130115851050
65130-146-85-1050130146851050
66130-165-85-1050130165851050
67130-305-85-80013030585800
68130-40-42-5001304042500
69130-40-85-105013040851050
70130-60-42-4001306042400
71130-60-85-8001306085800
72130-85-85-105013085851050
73130-95-85-105013095851050
74140-146-85-1050140146851050
75150-146-85-1050150146851050
76165-65-85-105016565851050
77201-80-85-105020180851050
781050    
79#VÄRDEFEL!    
80260-113-130-160026011313016001000_Test
81259-114-130-160025911413016002000_Test
823000_Test    
83XLARGE    
84130-100-130-10501301001301050
85130-146-130-10501301461301050
86130-180-130-10501301801301050
87130-305-130-10501303051301050
88130-80-120-1050130801201050
89130-80-130-1050130801301050
90140-260-130-10501402601301050
91MODULTYP    
921500-600-800-99999150060080099999
93Owerflow-plats    
94Virtuell plats    
95115-30-45-2501153045250
96115-42-45-2501154245250
97115-63-52-2501156352250
98260-18-30-1002601830100
99PLOCK    
100#VÄRDEFEL!    
101405-53-80-200040553802000
102405-68-80-200040568802000
103610-450-130-2350061045013023500
104240-220-140-20002402201402000
105280-880-240-80002808802408000
Weeble
Cell Formulas
RangeFormula
J3:J105J3=IFERROR(VALUE(LEFT($H3,FIND("-",$H3)-1)),"")
K3:K105K3=IFERROR(VALUE(MID($H3,SEARCH("x",SUBSTITUTE($H3,"-","x",1))+1,SEARCH("y",SUBSTITUTE($H3,"-","y",2))-SEARCH("x",SUBSTITUTE($H3,"-","x",1))-1)),"")
L3:L105L3=IFERROR(VALUE(MID($H3,SEARCH("y",SUBSTITUTE($H3,"-","y",2))+1,SEARCH("z",SUBSTITUTE($H3,"-","z",3))-SEARCH("y",SUBSTITUTE($H3,"-","y",2))-1)),"")
M3:M105M3=IFERROR(VALUE(RIGHT($H3,LEN($H3)-SEARCH("z",SUBSTITUTE($H3,"-","z",3)))),"")
 
Upvote 0

Forum statistics

Threads
1,214,590
Messages
6,120,421
Members
448,961
Latest member
nzskater

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