This is a bit involved. A file is attached to follow along. Hope this helps.
In sheet Description and Price build a lookup table. Start by extracting the heights and widths from column A into columns C and D with these formulas. In column C
Formula:
=--MID($A2,FIND("|",$A2)+1,3)
in column D
Formula:
=MID($A2,LOOKUP(25^25,FIND("|",$A2,ROW($1:$50)))+2,99)
Then to make row and column headers for the lookup table array-enter this formula in F2 and fill down to F15.
Formula:
=SMALL(IF(FREQUENCY($C$2:$C$127,$C$2:$C$127),$C$2:$C$127),ROWS($1:1))
If you aren’t familiar with array-entered formulas array enter means the formula must be committed from edit mode by simultaneously pressing and holding down Ctrl and Shift while hitting Enter.
That will extract the unique height values. Then to extract unique column headers enter this array-entered formula in G1 and fill across to O1. (Again committing with Ctrl + Shift + Enter.)
Formula:
=INDEX($D$2:$D$127,SMALL(IF(FREQUENCY(MATCH($D$2:$D$127,$D$2:$D$127,0),ROW($A$2:$A$127)-1),ROW($A$2:$A$127)-1),COLUMNS($A:A)))
Now that the headers are in place enter this formula in the regular way into G2:O15.
Formula:
=SUMIFS($B$2:$B$127,$C$2:$C$127,$F2,$D$2:$D$127,G$1)
That will put prices at the intersections of height and width.
With that in place go to the Main Spreadsheet and insert two helper columns that will be the new columns C and D. (BTW: this will also make the StoreCost column M now StoreCost column O.) In C2 enter this formula and fill down.
Formula:
=IFERROR(--MID(B2,SEARCH(""""&";",B2)-2,2),"no size")
and in D2 this formula.
Formula:
=TRIM(RIGHT(IF(ISNUMBER(C2),SUBSTITUTE(B2," ",REPT(" ",20)),""),20))
These extract height and width from the strings in column B and will be your lookup values for the final formula in the StoreCost column (now column O).
In O2 enter this formula and fill down.
Formula:
=IF(ISNUMBER($C2),INDEX('Description and Price'!$G$2:$O$15,MATCH('Main Spreadsheet'!$C2,'Description and Price'!$F$2:$F$15,0),MATCH('Main Spreadsheet'!$D2,'Description and Price'!$G$1:$O$1,0)),"no size")
Hope this helps.
Bookmarks