This is going to sound brutal, but I don't think I have ever seen such a badly organised file and coding system before.
Your formula is different in each row and therefore cannot be dragged to get the results you look for.
For example with this in C4
=VLOOKUP($B4,Sheet3!A2:B2,2,FALSE)
And this in C5
=VLOOKUP($B5,Sheet3!A5:B5,2,FALSE)
You might as well type the answers manually!
This approach will ""fix"" your immediate problem
=VLOOKUP(IF(ISERROR($B5*1),$B5,$B5*1),Sheet3!A5:B5,2,FALSE)
However.
Try breaking your lookup list into seperate sections/groups, 1 to 17,18. then refer to these by named ranges as required. (See "Sheet3")
For Example
"CodeGroup3"
Refers To:
Where there are illegal characters or spaces the name needs a little modification
"CodeGroup4,5" becomes "CodeGroup4_5"
Refers To:
We can now add a column to your sheet "Flash Decode" with the header "CodeGroup"
In this column we can now list the groups "1", "2", "3,4", etc...
By concatenating the header and the code group we can now use INDIRECT() to reference the Named Ranges, or directly, the actual string in "Sheet3".
(Unfortunately INDIRECT() doesn't like dynamic named ranges so these names are possibly easiest refering to whole columns.)
So in B4 this formula
Drag/Fill Down
This will find, for example, "CodeGroup3,4" ($A$3&$A7) in "Sheet3" Row 1 and return the value offset by 0 rows and 1 columns. In this example "Small Classification".
In D4
Drag/Fill Down
Let's break this down
1/. SUBSTITUTE($A$3&$A4,",","_")
This replaces any commas in the concatenated group name with underscores.
So for example "CodeGroup3,4" becomes "CodeGroup3_4"
2/. This can now refer to the named range by using ....
INDIRECT(SUBSTITUTE($A$3&$A4,",","_"))
3/. Now using INDEX(range,row,column)
range = INDIRECT(SUBSTITUTE($A$3&$A4,",","_"))
row = MATCH(value,range,return exact match =0)
MATCH(IF(ISERROR($C4*1),$C4,$C4*1),INDIRECT(SUBSTITUTE($A$3&$A4,",","_")),0)
Note
IF(ISERROR($C4*1),$C4,$C4*1) chooses whether to read your "Code" (Column C) value as text or a number.
column = the column to return the result from, in this case there is only one column in the named ranges so this is always 1
This is is written as
INDEX(INDIRECT(SUBSTITUTE($A$3&$A4,",","_")),MATCH(IF(ISERROR($C4*1),$C4,$C4*1),INDIRECT(SUBSTITUTE($A$3&$A4,",","_")),0),1)
4/. Finally Offset("index/match formula" ,0 (rows),1 (cols))
Note that #N/A will be returned if no match is found.
The way you are breaking down the Part# is not really logical, but if this is how the existing numbers are "formatted", then there might be nothing that can be done to improve the situation.
The fact that this returns 0 & 00 as potential codes is not easy to control.
The reason for your original formula failing is the lookup is trying to find e.g. "9" as a string not 9 as a number as it is in the lookup list(s).
See this link Contextures - Excel Data Validation -- Create Dependent Lists for a fuller explanation and more examples.
This is not nescessarily the best way to tackle your problem, but it is possibly the easiest way to present the results as you seem to want.
Hope this helps.
Bookmarks