INDEX & MATCH with INDIRECT Function

IDRIS86

Board Regular
Joined
Mar 18, 2021
Messages
82
Office Version
  1. 365
Platform
  1. Windows
Hi I tried to match the argument in the below formula to -1 to pull the higher values than the look up value. But its not working. Only with Match argument 0 & 1 works. But I need to pick value higher than my reference. Could you assist.

Below the function,

=INDEX(INDIRECT(Table10[@MODEL]&"A"),MATCH(BC28,INDIRECT(Table10[@MODEL]&"H"),0),MATCH(BB28,INDIRECT(Table10[@MODEL]&"W"),0))
 
If you are happy to rename your table as IBD2A, then you should be able to just copy the F6 formula to your F6
But I already named the content as IBD2A already. Sizes in rows are named as IBD2H & the ones in column as IBD2W. Please refer to the snapshot I attached, shows the table name.
 

Attachments

  • Table name.PNG
    Table name.PNG
    23 KB · Views: 6
Upvote 0

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
I am assuming the use of Excel Tables.
I suspect you are using named ranges.

View attachment 34885
I tried, it doesn't show me the values. Also will this work if I have different models and each have their tables?. So it automatically refers to the specific table upon the model in worksheet.

Work sheet.xlsx
EFGHIJKLMNOPQRSTU
10SIZE1021522032543053564064575085596106602900295030003048
11102535962666972758285899298420420420420
12152565962667275798285929598433433433433
1320359626672757985899298102105459459459459
1425459666972758285899598105108473473473473
153056269727982899295102108112115512512512512
1635666727582859295102108112118125538538538538
17406697579859295102108112118125131564564564564
184577279859295102108115118128131138604604604604
1950875828995102108115121128135141148643643643643
2055979859298105112118125131141148154669669669669
21610828995102108115121128135144151158683683683683
22660859298105112121128135141151158164722722722722
237118995102112118125135141148158164174761761761761
247629298105115121131138148154164171180788788788788
2581395102112118128135144151161171180187827827827827
2686495105115121131141148158167177187194853853853853
2791498108118128135144154164174184194200879879879879
289501511641771902032172302432562692822951286128612861286
2910001511641771902032172302432562692822951286128612861286
3010501581711841972102232362492632822953081339133913391339
3111001581711841972102232362492632822953081339133913391339
3211501641771902032172302432562692893023151365136513651365
3312001641771902032172302432562692893023151365136513651365
3412501711841972102232432562692823023153281444144414441444
3513001711841972102232432562692823023153281444144414441444
3613501771902032232362492692822953153283481523152315231523
3714001771902032232362492692822953153283481523152315231523
3814501841972102302432632762953083283413611575157515751575
3915001841972102302432632762953083283413611575157515751575
4015501902032232362562692893023223413613741654165416541654
4116001902032232362562692893023223413613741654165416541654
4216501902102302432632822953153353543743871706170617061706
4317001902102302432632822953153353543743871706170617061706
4417501972172362562692893083283483683874001759175917591759
4518001972172362562692893083283483683874001759175917591759
4618292462662853053253453643844044334534732048204820482048
Table
Cells with Conditional Formatting
CellConditionCell FormatStop If True
F11:U46Cell Value=0textNO






Work sheet.xlsx
BCDEF
4WIDTH (MM)HEIGHT (MM)TYPEMODELValue
5
6530508 FD IBD2 #REF!
7230220 FD IBD2 #REF!
Work sheet
Cell Formulas
RangeFormula
F6:F7F6=INDEX(INDIRECT(E6&"A"&"[#All]"),XMATCH(VALUE(B6),INDIRECT(E6&"A"&"[[#All],[SIZE]]"),1),XMATCH(TRIM(C6),INDIRECT(E6&"A"&"[#Headers]"),1))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
D7Cell Value=0textNO
E7Cell Value=0textNO
D7Cell Value=0textNO
E7Cell Value=0textNO
D6Cell Value=0textNO
E6Cell Value=0textNO
D6Cell Value=0textNO
E6Cell Value=0textNO
D5Cell Value=0textNO
E5Cell Value=0textNO
D5Cell Value=0textNO
E5Cell Value=0textNO
Cells with Data Validation
CellAllowCriteria
D5:D7List=TYPE
E5:E7List=INDIRECT(D5)
 
Upvote 0
It will work as long as you use excel tables with a table name = model name & A.
And you don't have spaces before & after the name in your work sheet model column.

If you already have a rangename of IBD2A you will need to delete that before trying to rename the table.
It's 2am here so I am login off now.
 
Upvote 0
Did you work out how to create and Excel table and name it IBD2A and get the formula to work ?
You can of course name is something else like IBD2X if you don't want to delete your range name but you would need to change the formula from & "A" to & "X".
 
Upvote 0
Did you work out how to create and Excel table and name it IBD2A and get the formula to work ?
You can of course name is something else like IBD2X if you don't want to delete your range name but you would need to change the formula from & "A" to & "X".
Hi I tried with my same formula by removing the table format in the worksheet input page and when I tried copied down the drop down rows. it works well.

But I have another issue. In the same work sheet, I needed other values from some other table. I used the same formula which worked out before for me as below.
I included an IF condition in addition.
The issue is it pulls the values at higher look up values. Let say the inputs width is 420 & height is 212. the database table has next higher lookup values Width 406 and next higher is 508. For height is 203 and next higher is 305. I needed the formula to pull the values of Width 508 and height 305. which is 61. But it pulls 66, which could be the value of next higher sizes.
I highlighted in table. Please assist.

=IF(E4="YES",INDEX(INDIRECT($E$3&"A"),XMATCH(D4,INDIRECT($E$3&"H"),1 ),XMATCH(C4,INDIRECT($E$3&"W"),1 )),0)



Work sheet 2.xlsx
BCDEFG
3S. NOWIDTH (MM)HEIGHT (MM)SLEEVESLEEVE TYPESLEEVE
41420212 YES 24 IN 16 GA 66
INPUT
Cell Formulas
RangeFormula
G4G4=IF(E4="YES",INDEX(INDIRECT($E$3&"A"),XMATCH(D4,INDIRECT($E$3&"H"),1 ),XMATCH(C4,INDIRECT($E$3&"W"),1 )),0)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
E4Cell Valuecontains "NO"textNO
G4Cell Value=0textNO
Cells with Data Validation
CellAllowCriteria
E4List=List!$T$5:$T$6
F4List=LENGTHGAUGE









Work sheet 2.xlsx
EFGHIJKLMNOPQRSTUVWXYZAAAB
14SIZE10220330540650861071181391410161118121913211422695070007050710071507200725073007350
15102263339445055697580869298108113515515531531531531531531568
162033339445055617580869298103113120531531548548548548548548584
1730539445055616680869298103109120125548548564564564564564564601
18406445055616672869298103109114125131564564581581581581581581617
195085055616672779298103109114120131136581581597597597597597597637
2061055616672778498103109114120125136142597597614614614614614614653
21711697580869298118123129134140145160165680680696696696696696696749
228137580869298103123129134140145152165171696696716716716716716716766
2391480869298103109129134140145152157171176716716733733733733733733782
241016869298103109114134140145152157163176182733733749749749749749749799
2511189298103109114120140145152157163168182188749749766766766766766766815
26121998103109114120125145152157163168174188194766766782782782782782782832
274700376393409426442459528545564581597614660677261426142663266326632663266326632831
284750376393409426442459528545564581597614660677261426142663266326632663266326632831
294800376393409426442459528545564581597614660677261426142663266326632663266326632831
304850376393409426442459528545564581597614660677261426142663266326632663266326632831
314900393409426442459475545564581597614630677693266326632713271327132713271327132881
324950393409426442459475545564581597614630677693266326632713271327132713271327132881
335000393409426442459475545564581597614630677693266326632713271327132713271327132881
Sheet 1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
F15:AB33Cell Value=0textNO
 
Upvote 0
Thanks for including all the information, step 1 is generally trying to replicate what you are doing and having all the XL2BB data really helps.
I am assuming your data " YES "& " 24 IN 16 GA " doesn't have the leading and trailing spaces I am getting because you definitely don't want them
(if you have anything different in those cells let me know because it would be helpful to know what is causing the additional spaces since its not happening in the actual column headings)

Your formula looks fine. What I can't see your range names and I suspect the ranges are out of sync.
Match gives you a count from the left or top starting at 1, therefore the starting point for the 2 x-y (width-height) match ranges needs to be the same as your target area.
With your table's top left corner being E14, the simplest formula would be that SLEEVEW, SLEEVEH, SLEEVEA, all start at E14.
(yes you could focus on just the data range but then all 3 range names would need to start at a different cell reference, so why make it difficult for yourself)

Let me know how you go.

PS: the one thing I was missing that you might want to display visually on your charts is which dimension is which (ie Width vs Height).
 
Upvote 0
Thanks for including all the information, step 1 is generally trying to replicate what you are doing and having all the XL2BB data really helps.
I am assuming your data " YES "& " 24 IN 16 GA " doesn't have the leading and trailing spaces I am getting because you definitely don't want them
(if you have anything different in those cells let me know because it would be helpful to know what is causing the additional spaces since its not happening in the actual column headings)

Your formula looks fine. What I can't see your range names and I suspect the ranges are out of sync.
Match gives you a count from the left or top starting at 1, therefore the starting point for the 2 x-y (width-height) match ranges needs to be the same as your target area.
With your table's top left corner being E14, the simplest formula would be that SLEEVEW, SLEEVEH, SLEEVEA, all start at E14.
(yes you could focus on just the data range but then all 3 range names would need to start at a different cell reference, so why make it difficult for yourself)

Let me know how you go.

PS: the one thing I was missing that you might want to display visually on your charts is which dimension is which (ie Width vs Height).
Hi, I haven't considered leading & trailing spaces at text "YES". To obtain this value "24 IN 16GA" is not a dependent. So I removed it from the table.
I just applied the same formula which worked out for me the tables we discussed before. I'm not aware about other formula which could help me on my requirement.
I highlighted in the table now. Width is in green color & Height in blue. If there is any other way with some formula. My requirement is upon selecting YES in the input condition, the formula to pick values from the table with reference to given width & height inputs. If give size not available, it needs to pick the value of next immediate higher width & height. please assist.

Work sheet 2.xlsx
EFGHIJKLMNOPQRSTUVWXYZAAAB
14SIZE10220330540650861071181391410161118121913211422695070007050710071507200725073007350
15102263339445055697580869298108113515515531531531531531531568
162033339445055617580869298103113120531531548548548548548548584
1730539445055616680869298103109120125548548564564564564564564601
18406445055616672869298103109114125131564564581581581581581581617
195085055616672779298103109114120131136581581597597597597597597637
2061055616672778498103109114120125136142597597614614614614614614653
21711697580869298118123129134140145160165680680696696696696696696749
228137580869298103123129134140145152165171696696716716716716716716766
2391480869298103109129134140145152157171176716716733733733733733733782
241016869298103109114134140145152157163176182733733749749749749749749799
2511189298103109114120140145152157163168182188749749766766766766766766815
26121998103109114120125145152157163168174188194766766782782782782782782832
274700376393409426442459528545564581597614660677261426142663266326632663266326632831
284750376393409426442459528545564581597614660677261426142663266326632663266326632831
294800376393409426442459528545564581597614660677261426142663266326632663266326632831
304850376393409426442459528545564581597614660677261426142663266326632663266326632831
314900393409426442459475545564581597614630677693266326632713271327132713271327132881
324950393409426442459475545564581597614630677693266326632713271327132713271327132881
335000393409426442459475545564581597614630677693266326632713271327132713271327132881
Sheet 1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
F15:AB33Cell Value=0textNO



Work sheet 2.xlsx
BCDEF
3S. NOWIDTH (MM)HEIGHT (MM)SLEEVESLEEVE
41420212 YES 66
INPUT
Cell Formulas
RangeFormula
F4F4=IF(E4="YES",INDEX(INDIRECT($E$3&"A"),XMATCH(D4,INDIRECT($E$3&"H"),1 ),XMATCH(C4,INDIRECT($E$3&"W"),1 )),0)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
E4Cell Valuecontains "NO"textNO
F4Cell Value=0textNO
Cells with Data Validation
CellAllowCriteria
E4List=List!$T$5:$T$6
 
Upvote 0
I do understand what you are saying but I believe your issue is not caused by the formula but by the range names.

Change your range names to match mine and I think you will find that it works.
(Obviously the sheet name part will be different)

1616395265570.png
 
Upvote 0
I do understand what you are saying but I believe your issue is not caused by the formula but by the range names.

Change your range names to match mine and I think you will find that it works.
(Obviously the sheet name part will be different)

View attachment 34969
I tried to change SLEEVEA also with E14 and it picks lesser value than required.

Work sheet 2.xlsx
BCDEF
3S. NOWIDTH (MM)HEIGHT (MM)SLEEVESLEEVE
41420212 YES 55
INPUT
Cell Formulas
RangeFormula
F4F4=IF(E4="YES",INDEX(INDIRECT($E$3&"A"),XMATCH(D4,INDIRECT($E$3&"H"),1 ),XMATCH(C4,INDIRECT($E$3&"W"),1 )),0)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
E4Cell Valuecontains "NO"textNO
F4Cell Value=0textNO
Cells with Data Validation
CellAllowCriteria
E4List=List!$T$5:$T$6



Work sheet 2.xlsx
EFGHIJKLMNOPQRSTUVWXYZAAAB
14SIZE10220330540650861071181391410161118121913211422695070007050710071507200725073007350
15102263339445055697580869298108113515515531531531531531531568
162033339445055617580869298103113120531531548548548548548548584
1730539445055616680869298103109120125548548564564564564564564601
18406445055616672869298103109114125131564564581581581581581581617
195085055616672779298103109114120131136581581597597597597597597637
2061055616672778498103109114120125136142597597614614614614614614653
21711697580869298118123129134140145160165680680696696696696696696749
228137580869298103123129134140145152165171696696716716716716716716766
2391480869298103109129134140145152157171176716716733733733733733733782
241016869298103109114134140145152157163176182733733749749749749749749799
2511189298103109114120140145152157163168182188749749766766766766766766815
26121998103109114120125145152157163168174188194766766782782782782782782832
274700376393409426442459528545564581597614660677261426142663266326632663266326632831
284750376393409426442459528545564581597614660677261426142663266326632663266326632831
294800376393409426442459528545564581597614660677261426142663266326632663266326632831
304850376393409426442459528545564581597614660677261426142663266326632663266326632831
314900393409426442459475545564581597614630677693266326632713271327132713271327132881
324950393409426442459475545564581597614630677693266326632713271327132713271327132881
335000393409426442459475545564581597614630677693266326632713271327132713271327132881
Sheet 1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
F15:AB33Cell Value=0textNO
 
Upvote 0

Forum statistics

Threads
1,215,981
Messages
6,128,080
Members
449,418
Latest member
arm56

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