Is this crazy or am I. Match function result different than expected.

DigitalZugzwang

New Member
Joined
Jul 27, 2017
Messages
20
I have a workbook with a number of tables for dependent lists. Below is the formula for the third dependent list and it works for the most part, but I am getting strange results. When certain values are selected in column B the problem part of the below formula will result in #N/A or the wrong row. If I change the value in the table that is giving me a problem the code will work if it "likes" the new value.

For example, if I put in the word Flag Pole I get the #N/A but if I put in Test it will result in 3 when it should have been 5. I have no idea what is going on here. PLEASE HELP!

INDIRECT(INDEX(INDIRECT(SUBSTITUTE(SUBSTITUTE(A23,"/","")," ","")),MATCH(B23,INDIRECT(SUBSTITUTE(SUBSTITUTE(A23,"/","")," ","")&"["&SUBSTITUTE(SUBSTITUTE(A23,"/","")," ","")&"]",0)),2))

Below is the portion of the formula that is acting up.

MATCH(B23,INDIRECT(SUBSTITUTE(SUBSTITUTE(A23,"/","")," ","")&"["&SUBSTITUTE(SUBSTITUTE(A23,"/","")," ","")&"]",0))

Below are two of the tables I'm using Activity (1 column) and Erection (2 columns)
[TABLE="width: 162"]
<tbody>[TR]
[TD][TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Activity[/TD]
[TD][/TD]
[TD]Erection[/TD]
[TD]Category[/TD]
[/TR]
[TR]
[TD]Erection[/TD]
[TD][/TD]
[TD]Guyed[/TD]
[TD]Base Cost[/TD]
[/TR]
[TR]
[TD]Install[/TD]
[TD][/TD]
[TD]Mono[/TD]
[TD]Base Cost[/TD]
[/TR]
[TR]
[TD]Repair[/TD]
[TD][/TD]
[TD]Self Support[/TD]
[TD]Base Cost[/TD]
[/TR]
[TR]
[TD]Inspection[/TD]
[TD][/TD]
[TD]Water Tank[/TD]
[TD]Base Cost[/TD]
[/TR]
[TR]
[TD]Modification[/TD]
[TD][/TD]
[TD]Flag Pole[/TD]
[TD]Base Cost[/TD]
[/TR]
[TR]
[TD]Decom[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Purchase/Sale[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Sub[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Ancillary[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
</tbody><colgroup><col></colgroup>[/TABLE]
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Really hard to say without seeing a better sample of what you are working with, but are you putting that text in A23, or where?
Why are you (from the looks of it) doubling up on the text?
INDIRECT(
SUBSTITUTE(SUBSTITUTE(A23,"/","")," ","")&"["&
SUBSTITUTE(SUBSTITUTE(A23,"/","")," ","")&"]",0))

and what are the [ and ] for?
 
Upvote 0
No I was pulling the text from A23. The reason I was doubling up like that is to get a table and column reference because I'm using dependent lists. So I needed to get Activity[Activity] to target the Activity table and the Activity column of that table. Its the whole reason I named the column and the table the same thing.

That being said I found a work around with vlookup. I don't like using vlookup but it is working.
 
Upvote 0
That formula is 'really' hard (and I mean really) to decipher.
But it looks like you have the 3rd option in the match function omitted. Which makes match do a 'closest match' type of lookup.
If that is the case, then match assumes your data is sorted in ascending order (which it's not).
All sorts of strange things happen with unsorted data and the match doing a 'closest match' type.

Your match needs to have the 3rd argument set to 0 to make it do an exact match.
MATCH(B23,INDIRECT(SUBSTITUTE(SUBSTITUTE(A23,"/","")," ","")&"["&SUBSTITUTE(SUBSTITUTE(A23,"/","")," ","")&"]",0),0)
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

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