Formula with IF, AND, INDEX, MATCH and SUM returning N/A

OneChief

New Member
Joined
May 5, 2021
Messages
23
Office Version
  1. 365
Platform
  1. Windows
Good Morning,

I am trying to Sum a combination of cells with IF, AND, INDEX and MATCH.
Individually the statement works. Also when all cells have values the statement sometimes works and sometimes produces a #ref Error..
Examples below.
Scenario:
One table holds values "Front Height 1, 2, 3" and "Front 1, 2 ,3 Width"
1620685194795.png


The next lot of cells have a formula to set up the values for an INDEX, MATCH to then produce a price from a pricing matrix.
1620685471627.png

1620685511459.png

=IF(B2<=0,0,IF(B2<=200,200,IF(B2<=400,400,IF(B2<=600,600,IF(B2<=750,750,IF(B2<=900,900,IF(B2<=1200,1200,IF(B2<=1500,1500,IF(B2<=1800,1800,IF(B2<=2100,2100,IF(B2<=2400,2400,IF(B2<=2700,2700,IF(B2<=3050,3050,"0")))))))))))))

Cell S2 (and beyond) then has the statement that I need to work.
It looks at 2 conditions being S1 = PM_Style01_TextAsh (Which is a table that produces pricing based on a height and width)
1620686053890.png

and if R2 = Door.
This is what I have that I thought was correct but is not working. I have tried a variety of IFS and SUMIF etc, with varied results non of which I have managed to be correct.
=IF(AND($S$1="PM_Style01_TextAsh",R2="Door"),SUM(INDEX(PM_Style01_TextAsh,MATCH(L2,PM_Style01_TextAshH),MATCH(M2,PM_Style01_TextAshW)),INDEX(PM_Style01_TextAsh,MATCH(N2,PM_Style01_TextAshH),MATCH(O2,PM_Style01_TextAshW),INDEX(PM_Style01_TextAsh,MATCH(P2,PM_Style01_TextAshH),MATCH(Q2,PM_Style01_TextAshW)))))

Thank you for your wisdom :-)

Chief.
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Please post your sample data using XL2BB so those trying to help don't have to retype the data. Thanks.
 
Upvote 0
Look on the tool bar just above the typing area.

Also, give your example, what do you want as the result?
 
Upvote 0
First time using XL2BB Add in. Forgive me if I Have not done it correctly.

BID_Pricing.xlsm
BCDEFGHIJKLMNOPQRST
1Front Height 1Front Height 2Front Height 3Front Height 4Front Height 5Front Height 6Front 1 WidthFront 2 WidthFront 3 WidthH1 (Lookup)W1 (Lookup)H2 (Lookup)W2 (Lookup)H3 (Lookup)W3 (Lookup)PM_Style01_TextAshPM_Style02_TextAsh
23801474001500000Door#N/A
3380197
WallCabinets
Cell Formulas
RangeFormula
L2L2=IF(B2<=0,0,IF(B2<=200,200,IF(B2<=400,400,IF(B2<=600,600,IF(B2<=750,750,IF(B2<=900,900,IF(B2<=1200,1200,IF(B2<=1500,1500,IF(B2<=1800,1800,IF(B2<=2100,2100,IF(B2<=2400,2400,IF(B2<=2700,2700,IF(B2<=3050,3050,"0")))))))))))))
M2M2=IF(H2<=0,0,IF(H2<=150,150,IF(H2<=300,300,IF(H2<=350,350,IF(H2<=400,400,IF(H2<=450,450,IF(H2<=500,500,IF(H2<=550,550,IF(H2<=600,600,IF(H2<=650,650,IF(H2<=800,800,IF(H2<=1000,1000,IF(H2<=1200,1200,"ERROR")))))))))))))
N2N2=IF(C2<=0,0,IF(C2<=200,200,IF(C2<=400,400,IF(C2<=600,600,IF(C2<=750,750,IF(C2<=900,900,IF(C2<=1200,1200,IF(C2<=1500,1500,IF(C2<=1800,1800,IF(C2<=2100,2100,IF(C2<=2400,2400,IF(C2<=2700,2700,IF(C2<=3050,3050,"0")))))))))))))
O2O2=IF(I2<=0,0,IF(I2<=200,200,IF(I2<=400,400,IF(I2<=600,600,IF(I2<=750,750,IF(I2<=900,900,IF(I2<=1200,1200,IF(I2<=1500,1500,IF(I2<=1800,1800,IF(I2<=2100,2100,IF(I2<=2400,2400,IF(I2<=2700,2700,IF(I2<=3050,3050,"0")))))))))))))
P2P2=IF(D2<=0,0,IF(D2<=200,200,IF(D2<=400,400,IF(D2<=600,600,IF(D2<=750,750,IF(D2<=900,900,IF(D2<=1200,1200,IF(D2<=1500,1500,IF(D2<=1800,1800,IF(D2<=2100,2100,IF(D2<=2400,2400,IF(D2<=2700,2700,IF(D2<=3050,3050,"0")))))))))))))
Q2Q2=IF(J2<=0,0,IF(J2<=200,200,IF(J2<=400,400,IF(J2<=600,600,IF(J2<=750,750,IF(J2<=900,900,IF(J2<=1200,1200,IF(J2<=1500,1500,IF(J2<=1800,1800,IF(J2<=2100,2100,IF(J2<=2400,2400,IF(J2<=2700,2700,IF(J2<=3050,3050,"0")))))))))))))
S1:AN1S1=TRANSPOSE(Pt_PriceGroupT[Price Groups (Polytec)])
S2S2=IF(AND($S$1="PM_Style01_TextAsh",R2="Door"),SUM(INDEX(PM_Style01_TextAsh,MATCH(L2,PM_Style01_TextAshH),MATCH(M2,PM_Style01_TextAshW)),INDEX(PM_Style01_TextAsh,MATCH(N2,PM_Style01_TextAshH),MATCH(O2,PM_Style01_TextAshW),INDEX(PM_Style01_TextAsh,MATCH(P2,PM_Style01_TextAshH),MATCH(Q2,PM_Style01_TextAshW)))))
Dynamic array formulas.
Named Ranges
NameRefers ToCells
PM_Style01_TextAsh=Pt_Thermo_18mm!$C$8:$N$19S2
PM_Style01_TextAshH=Pt_Thermo_18mm!$B$8:$B$19S2
PM_Style01_TextAshW=Pt_Thermo_18mm!$C$7:$N$7S2
 
Upvote 0
What do you think?

May102021.xlsm
ABCDEFGHIJKLMNOPQRS
1F Hgt 1F Hgt 2F Hgt 3F Hgt 4F Hgt 5F Hgt 6F Wid 1F Wid 2F Wid 3H1 (lookup)W1 (lookup)H2W2H3W3PM_Style01_TextAsh
23901474001500000Door17,22
34501976003000000Door26.62
Sheet9
Cell Formulas
RangeFormula
L2:L3L2=IFERROR(INDEX(Pt_Thermo_18mm!$C$8:$I$20,MATCH(TRUE,Pt_Thermo_18mm!$C$8:$C$20>=B2,0),1),0)
M2:M3M2=IFERROR(INDEX(Pt_Thermo_18mm!$C$8:$I$20,1,MATCH(TRUE,Pt_Thermo_18mm!$C$8:$I$8>=H2,0)),0)
N2:N3N2=IFERROR(INDEX(Pt_Thermo_18mm!$C$8:$I$20,MATCH(TRUE,Pt_Thermo_18mm!$C$8:$C$20>=C2,0),1),0)
O2:O3O2=IFERROR(INDEX(Pt_Thermo_18mm!$C$8:$I$20,1,MATCH(TRUE,Pt_Thermo_18mm!$C$8:$I$8>=I2,0)),0)
P2:P3P2=IFERROR(INDEX(Pt_Thermo_18mm!$C$8:$I$20,MATCH(TRUE,Pt_Thermo_18mm!$C$8:$C$20>=D2,0),1),0)
Q2:Q3Q2=IFERROR(INDEX(Pt_Thermo_18mm!$C$8:$I$20,1,MATCH(TRUE,Pt_Thermo_18mm!$C$8:$I$8>=J2,0)),0)
S2:S3S2=IF(AND("Door" =R2,"PM_Style01_TextAsh"=$S$1),INDEX(Pt_Thermo_18mm!$C$8:$I$20,MATCH(TRUE,Pt_Thermo_18mm!$C$8:$C$20>=$B2,0),MATCH(TRUE,Pt_Thermo_18mm!$C$8:$I$8>=$H2,0)),"")
 
Upvote 0
What answer should be in S2? 21.82, maybe?
Ok, so if L2 and M2 have measurements (400 x 150) only the answer will be 17.22.
If L2, M2 and N2, O2 have measurements (400 x 150) the answer will be 34.44
If L2, M2 and N2, O2 and P2, Q2 have measurements (400 x 150) the answer will be 51.66

This is the Matrix Table it is getting the prices from.
BID_Pricing.xlsm
ABCDEFGHIJKLMN
5 Width mm
6Height mm100 - 150*151 - 300301 - 350351 - 400401 - 450451 - 500501 - 550551 - 600601 - 650651 - 800801 - 10001001 - 1200
715030035040045050055060065080010001200
835 - 200*20014.4317.0317.8918.7619.6120.4921.3422.2323.0725.6829.1232.58
9201 - 40040017.2221.8223.3424.8626.4027.9129.4630.9832.5337.1143.2249.34
10401 - 60060020.0026.6228.7930.9833.1835.3837.5739.7741.9548.5557.3366.10
11601 - 75075022.0930.1932.9035.5938.2740.9643.6646.3649.0557.1267.8978.66
12751-90090024.2133.7836.9940.1543.3646.5649.7452.9356.1265.6978.4791.24
13901-1200120028.3940.9645.1749.3453.5357.7161.9166.1070.2982.8699.61116.38
141201-1500150032.5848.1653.3358.5163.7168.8974.0779.2784.44100.00120.76141.50
151501-1800180036.7655.3361.5267.6973.8980.0586.2492.4398.60117.17141.90194.09
161801-2100210040.9662.4969.6976.8784.0591.2498.42105.60112.80134.33163.05221.76
172101-2400240045.1669.6977.8886.0794.22102.40110.60118.77126.96151.48184.21249.39
182401 - 2700270050.8279.9489.6799.37109.08118.76128.50138.20147.93177.04215.87287.17
192701 - 3050305059.2795.00106.89118.80130.70142.58154.51166.41178.31214.03261.64341.70
20Drawer Bank & Individual up to 800mm**42.8545.5648.2550.9353.6256.3259.0261.7169.7880.5591.32
Pt_Thermo_18mm


This is another example of how it works based on single scenario, which works well. (But I need a sum)
Type (Door, Drawer)Height (mm)Width (mm)Style GroupMatrix TableHeight (LookUp)Width (LookUp)SqmSqm $Trade Price $MadeCo COGs $Sales Price $
Door380147S1PM_Style01_TextAsh4001500.06017.2210.8114.60
Drawer Individual720450S3PM_Style03_StudioStd7504500.340125.2578.66106.19
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,217
Members
452,619
Latest member
Shiv1198

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