Nested INDEX MATCH with IF help, please.

CS297

New Member
Joined
Dec 22, 2009
Messages
35
Hi Guys, can anyone tell me what's wrong with the following construction, please? All three components work individually so I assume it's the way I have put them together that's the problem. In the below, only the first component works.

{=IF(M2="IMP",INDEX(SchASTM,MATCH(N2,IF(WTInchASTM=R2,NominalASTM),IF(M2="MET",INDEX(SchASTM,MATCH(N2,IF(WallASTM=R2,NominalASTM),IF(M2="SCH",R2)))))))}

Probably an easy fix for anyone who knows what they are doing with Excel formulae - unfortunately that's not me!!

Thanks so much in advance for your help.
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
In what way does it not work exactly ?

What are you defining as the "first component" which does work ?
 
Upvote 0
It returns a FALSE in the cell.
The following work as independent formulae:
{=IF(M2="IMP",INDEX(SchASTM,MATCH(N2,IF(WTInchASTM=R2,NominalASTM))))}
{=
IF(M2="MET",INDEX(SchASTM,MATCH(N2,IF(WallASTM=R2,NominalASTM))))}
=IF(M2="SCH",R2)
I just need to put them all together into one forumula.
 
Upvote 0
I think you need to explain what you're trying to do, with a small sample of your data. Both of your MATCH functions contain a nested IF function without the 3rd argument.
 
Upvote 0
Hi Guys, can anyone tell me what's wrong with the following construction, please? All three components work individually so I assume it's the way I have put them together that's the problem. In the below, only the first component works.

{=IF(M2="IMP",INDEX(SchASTM,MATCH(N2,IF(WTInchASTM=R2,NominalASTM),IF(M2="MET",INDEX(SchASTM,MATCH(N2,IF(WallASTM=R2,NominalASTM),IF(M2="SCH",R2)))))))}

Probably an easy fix for anyone who knows what they are doing with Excel formulae - unfortunately that's not me!!

Thanks so much in advance for your help.

in RED above, what if WTInchASTM not equal to R2?
etc
 
Upvote 0
Am having trouble pasting images but the data is as follows:

My Table:
DIMSNB
(mm)
NB
(inch)
OD
(inch)
OD (mm)WTWT
(mm)
WT
(inch)
WT (SCH)
SCH1506"6.625168.3407.110.280FALSE

<tbody>
</tbody>

Source data:


NPS mmNom. Pipe SizeOD inchesOD mmThickness
mm inches
STDSchedKg/m
1506"6.625168.37.110.280STD4028.26
1506"6.625168.37.110.280STD28.26
1506"6.625168.310.970.432XS8042.56
1506"6.625168.310.970.432XS42.56
1506"6.625168.314.270.56212054.21
1506"6.625168.318.260.71916067.57
1506"6.625168.321.950.864XXSXXS79.22

<tbody>
</tbody>

Arrays:
A4:A174 = NominalASTM
B4:B174 = InchASTM
D4:D174 = ODASTM
E4:E174 = WallASTM
F4:F174 = WTInchASTM
H4:H174 = SchASTM
I4:I174 = KgmASTM

My customers order pipe thicknesses in 3 different ways, in Imperial, Metric and in Schedule. In column WT, I want to put the thickness however they have ordered it and then I want the next three columns to populate automatically with the three variants. To address this, I created column DIMS but I can't combine all the options into one formula. So basically, if I am working with Imperial, I put IMP under DIMS and enter, for example, 0.280 in the WT column and then I want the WT mm to update to 7.11, the inches to 0.280 and the Schedule to 40 (or STD).

In the above example, WTmm and WTinch work fine. Whether I enter IMP, MET or SCH, they are returning the correct values. The formulae in these cells are:
WTmm {=IF(M2="IMP",R2*25.4,IF(M2="MET",R2,IF(M2="SCH",INDEX(WallASTM,MATCH(N2,IF(SchASTM=R2,NominalASTM))))))}
WTinch {=IF(M2="IMP",R2,IF(M2="MET",R2/25.4,IF(M2="SCH",INDEX(WTInchASTM,MATCH(N2,IF(SchASTM=R2,NominalASTM))))))}

The issue with Sch is that the Metric or imperial value is not fixed. It differs based on the NB of the pipe - for example, STD in 6" is 7.11mm but in 8" it's 8.18mm. This is why I used an index/match formula.
 
Last edited:
Upvote 0
From post #3
It returns a FALSE in the cell.

This is because at least one of your IF statements (and possibly several of them) evaluate to FALSE, and you haven't specified in the IF statement what you want to do in that situation, as indicated in post #4 .

As your formula is quite complicated, it might not be obvious which part of the formula is the problem - try using Excel's Formula Evaluate tool to step through the formula one bit at a time.
 
Upvote 0
I cant say as i know what that IF is trying to do inside the MATCH formulas but here is how you could nest those 3 formulas based on value of M2.

=IF(M2="IMP",INDEX(SchASTM,MATCH(N2,IF(WTInchASTM=R2,NominalASTM))),IF(M2="MET",INDEX(SchASTM,MATCH(N2,IF(WallASTM=R2,NominalASTM))),IF(M2="SCH",R2,"M2 doesn’t equal any")))
 
Upvote 0
Thanks, Steve. WT SCH is now returning a Sch value but not the correct one. In the below, it's saying STD under Sch but it should say 80.

DIMSNB
(mm)
NB
(inch)
OD
(inch)
OD (mm)WTWT
(mm)
WT
(inch)
WT (SCH)
IMP1506"6.625168.30.43210.970.432STD

<colgroup><col><col><col><col><col><col><col span="2"><col></colgroup><tbody>
</tbody>
 
Upvote 0
I think it's fixed. Slight tweak to the end and it works on all combos. Thanks so much, Steve.

{=IF(M2="IMP",INDEX(SchASTM,MATCH(N2,IF(WTInchASTM=R2,NominalASTM))),IF(M2="MET",INDEX(SchASTM,MATCH(N2,IF(WallASTM=R2,NominalASTM))),IF(M2="SCH",R2)))}
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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