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)
ActivityErectionCategory
ErectionGuyedBase Cost
InstallMonoBase Cost
RepairSelf SupportBase Cost
InspectionWater TankBase Cost
ModificationFlag PoleBase Cost
Decom
Purchase/Sale
Sub
Ancillary

<tbody>
</tbody>


<tbody>
</tbody><colgroup><col></colgroup>
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
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,214,919
Messages
6,122,259
Members
449,075
Latest member
staticfluids

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