Index/Match with multiple headers and tables

Bjomesphat

New Member
Joined
Jun 7, 2022
Messages
6
Office Version
  1. 365
Platform
  1. Windows
I'm trying to setup a formula for products I produce and ship that will automatically pull the correct shipping price based on a defined set of criteria. I've been able to do this with Index after I heavily edit my shipping tables, but I was hoping someone could assist me with this when my shipping tables are formatted as I receive them. One of the main questions I have is, is it possible to have 2 headers in a table (among multiple tables), and have the formula pull from two sets of criteria based on those headers? For example, below I have my product list with 3 sets of criteria: weight, carrier, zone. Ideally, I would want the formula to look at the main header which is the carrier, then look to the zone as the sub-header, and choose the correct cost based on the next greatest weight value.

So far all I've done is crudely stitched all of my shipping data together and setup some basic index formulas and I used XMATCH to get the next largest weight value in order to pull the cost, but that's requiring me to select my arrays very specifically for each product. I'm trying to automate this a little better, but have no idea where to start. Thanks for any and all help that can be provided.

Book1
ABCDEF
1SKUDescriptionWeightCarrierZoneCost
2180211x14 Canvas - Felt Back35.04Select8
31122White Ceramic Mug 11oz 13Parcel1
45069Mouse Pad 8Flat1
5115005x7 JOURNAL - WIRE-O14BPM5
Sheet2


Book1
ABCDEFGHIJKLMNOPQRSTUVW
1FlatsParcelsBPMSelect
2OZZone 1OZZone 1OZZone 1&2Zone 3Zone 4Zone 5Zone 6Zone 7Zone 8OZZone 1&2Zone 3Zone 4Zone 5Zone 6Zone 7Zone 8
31$1.151$3.4516$2.84$2.86$2.86$2.86$2.89$2.90$2.9016$4.90$5.23$5.60$6.16$6.23$6.36$6.36
42$1.152$3.4524$2.96$3.04$3.08$3.17$3.25$3.26$3.2732$5.20$5.73$6.07$6.60$7.24$7.59$7.82
53$1.243$3.4532$3.16$3.27$3.35$3.50$3.67$3.68$3.7048$5.45$6.14$6.84$7.32$8.26$8.73$9.18
64$1.374$3.4540$3.41$3.55$3.63$3.79$4.01$4.01$4.0464$7.16$7.68$8.56$9.16$10.24$10.67$10.67
75$1.535$4.0348$3.52$3.68$3.79$3.98$4.22$4.38$4.39
86$1.686$4.0356$3.76$3.93$4.07$4.27$4.35$4.60$4.61
97$1.847$4.0364$3.87$4.05$4.20$4.33$4.44$4.81$4.82
108$2.008$4.0372$3.98$4.19$4.35$4.49$4.65$5.06$5.10
119$2.159$4.5980$4.23$4.46$4.66$5.11$5.39$5.41$5.43
1210$2.3110$4.5996$4.45$4.74$4.96$5.36$5.84$5.87$5.88
1311$2.4611$4.59112$4.70$5.00$5.27$5.74$6.30$6.32$6.39
1412$2.6212$4.59128$4.79$5.02$5.33$5.88$6.51$6.51$6.53
1513$2.7813$5.23144$5.07$5.33$5.69$6.31$7.59$8.48$8.93
1614$4.7314$5.97160$6.51$7.01$7.50$8.25$9.24$9.73$11.47
1715$4.7315$5.97176$6.82$7.37$7.91$8.73$9.82$10.37$12.28
1816$4.7316$5.97192$7.13$7.73$8.32$9.21$10.40$11.00$13.08
19208$7.46$8.11$8.75$9.72$11.01$11.66$13.91
20224$7.75$8.44$9.14$10.18$11.57$12.26$14.69
21240$8.07$8.82$9.56$10.68$12.16$12.91$15.51
Sheet1
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Hi

Try power query to automate this process. I solved it but I am not sure how to attach file here. Any link where I can share excel file solution with you?

SKUDescriptionWeightCarrierZoneCost
180211x14 Canvas - Felt Back35.04Select8
9.1756​
1122White Ceramic Mug 11oz13Parcel1
5.2312​
5069Mouse Pad8Flat1
1.9968​
115005x7 JOURNAL - WIRE-O14BPM5
2.8644​

Cheers!!
 
Upvote 0
Hi

Try power query to automate this process. I solved it but I am not sure how to attach file here. Any link where I can share excel file solution with you?

SKUDescriptionWeightCarrierZoneCost
180211x14 Canvas - Felt Back35.04Select8
9.1756​
1122White Ceramic Mug 11oz13Parcel1
5.2312​
5069Mouse Pad8Flat1
1.9968​
115005x7 JOURNAL - WIRE-O14BPM5
2.8644​

Cheers!!

I've never used power query before, but I'd love to be able to look at you file. I don't think Mr Excel allows attachments, but you can use something like WeTransfer - Send Large Files & Share Photos Online - Up to 2GB Free.

Just upload the file, click get link, and copy/paste it here.

Really appreciate it!
 
Upvote 0
I solved it but I am not sure how to attach file here. Any link where I can share excel file solution with you?
If you have a solution, please post it in the forum, not just in a file that you provide a link to. Refer to #4 of the Forum Rules, particularly the last paragraph.
 
Upvote 0
Maybe something like this

Sheet1
Note the headers on row 1 on Sheet1 (gray) - they all need to be in the same column as Zone 1 or Zone 1&2, i.e. precisely on B1, E1, H1, Q1.

07062022 Testes.xlsx
ABCDEFGHIJKLMNOPQRSTUVW
1FlatsParcelsBPMSelect
2OZZone 1OZZone 1OZZone 1&2Zone 3Zone 4Zone 5Zone 6Zone 7Zone 8OZZone 1&2Zone 3Zone 4Zone 5Zone 6Zone 7Zone 8
311,1513,45162,842,862,862,862,892,902,90164,905,235,606,166,236,366,36
421,1523,45242,963,043,083,173,253,263,27325,205,736,076,607,247,597,82
531,2433,45323,163,273,353,503,673,683,70485,456,146,847,328,268,739,18
641,3743,45403,413,553,633,794,014,014,04647,167,688,569,1610,2410,6710,67
751,5354,03483,523,683,793,984,224,384,39
861,6864,03563,763,934,074,274,354,604,61
971,8474,03643,874,054,204,334,444,814,82
1082,0084,03723,984,194,354,494,655,065,10
1192,1594,59804,234,464,665,115,395,415,43
12102,31104,59964,454,744,965,365,845,875,88
13112,46114,591124,705,005,275,746,306,326,39
14122,62124,591284,795,025,335,886,516,516,53
15132,78135,231445,075,335,696,317,598,488,93
16144,73145,971606,517,017,508,259,249,7311,47
17154,73155,971766,827,377,918,739,8210,3712,28
18164,73165,971927,137,738,329,2110,4011,0013,08
192087,468,118,759,7211,0111,6613,91
202247,758,449,1410,1811,5712,2614,69
212408,078,829,5610,6812,1612,9115,51
Sheet1


Sheet2
I used 3 auxiliary columns (H, I, J) to simplify the formula in column F and also for better understanding and ease of editing.

07062022 Testes.xlsx
ABCDEFGHIJ
1SKUDescriptionWeightCarrierZoneCostColumnRowZone Relative Position
2180211x14 Canvas - Felt Back35,04Select89,17561637
31122White Ceramic Mug 11oz 13Parcels15,23124131
45069Mouse Pad 8Flats11,9968181
5115005x7 JOURNAL - WIRE-O14BPM52,8644714
Sheet2
Cell Formulas
RangeFormula
H2:H5H2=MATCH(D2,Sheet1!$1:$1,0)-1
I2:I5I2=IFERROR(MATCH(C2,INDEX(Sheet1!A$3:W$21,0,H2))+IF(ISNUMBER(MATCH(C2,INDEX(Sheet1!A$3:W$21,0,H2),0)),0,1),1)
J2:J5J2=MATCH("*"&E2&"*",INDEX(Sheet1!$2:$2,H2+1):INDEX(Sheet1!$2:$2,23),0)
F2:F5F2=INDEX(Sheet1!A$3:W$21,I2,J2+H2)


Hope this helps

M.
 
Upvote 0
Solution
Maybe something like this

Sheet1
Note the headers on row 1 on Sheet1 (gray) - they all need to be in the same column as Zone 1 or Zone 1&2, i.e. precisely on B1, E1, H1, Q1.

07062022 Testes.xlsx
ABCDEFGHIJKLMNOPQRSTUVW
1FlatsParcelsBPMSelect
2OZZone 1OZZone 1OZZone 1&2Zone 3Zone 4Zone 5Zone 6Zone 7Zone 8OZZone 1&2Zone 3Zone 4Zone 5Zone 6Zone 7Zone 8
311,1513,45162,842,862,862,862,892,902,90164,905,235,606,166,236,366,36
421,1523,45242,963,043,083,173,253,263,27325,205,736,076,607,247,597,82
531,2433,45323,163,273,353,503,673,683,70485,456,146,847,328,268,739,18
641,3743,45403,413,553,633,794,014,014,04647,167,688,569,1610,2410,6710,67
751,5354,03483,523,683,793,984,224,384,39
861,6864,03563,763,934,074,274,354,604,61
971,8474,03643,874,054,204,334,444,814,82
1082,0084,03723,984,194,354,494,655,065,10
1192,1594,59804,234,464,665,115,395,415,43
12102,31104,59964,454,744,965,365,845,875,88
13112,46114,591124,705,005,275,746,306,326,39
14122,62124,591284,795,025,335,886,516,516,53
15132,78135,231445,075,335,696,317,598,488,93
16144,73145,971606,517,017,508,259,249,7311,47
17154,73155,971766,827,377,918,739,8210,3712,28
18164,73165,971927,137,738,329,2110,4011,0013,08
192087,468,118,759,7211,0111,6613,91
202247,758,449,1410,1811,5712,2614,69
212408,078,829,5610,6812,1612,9115,51
Sheet1


Sheet2
I used 3 auxiliary columns (H, I, J) to simplify the formula in column F and also for better understanding and ease of editing.

07062022 Testes.xlsx
ABCDEFGHIJ
1SKUDescriptionWeightCarrierZoneCostColumnRowZone Relative Position
2180211x14 Canvas - Felt Back35,04Select89,17561637
31122White Ceramic Mug 11oz 13Parcels15,23124131
45069Mouse Pad 8Flats11,9968181
5115005x7 JOURNAL - WIRE-O14BPM52,8644714
Sheet2
Cell Formulas
RangeFormula
H2:H5H2=MATCH(D2,Sheet1!$1:$1,0)-1
I2:I5I2=IFERROR(MATCH(C2,INDEX(Sheet1!A$3:W$21,0,H2))+IF(ISNUMBER(MATCH(C2,INDEX(Sheet1!A$3:W$21,0,H2),0)),0,1),1)
J2:J5J2=MATCH("*"&E2&"*",INDEX(Sheet1!$2:$2,H2+1):INDEX(Sheet1!$2:$2,23),0)
F2:F5F2=INDEX(Sheet1!A$3:W$21,I2,J2+H2)


Hope this helps

M.

Been playing with this now, and this indeed works wonderfully. Thank you very much for the assistance! The use of auxillary columns is very clever, and should come in handy in the future.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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