Excel: INDEX MATCH with partial number

二次信任 提交于 2019-12-11 05:48:34

问题


I have a large table of 12 digit numbers and associated info

I have a small list of 10 and 11 digit numbers (the first and/or last digits were cut off) - I'm attempting to cross these two lists to identify the items on the small list

normally, I'd use an index match to bring the associated info out of the table into the list, but because today I have only partial numbers in my list, I can't get the formula to work

I've seen other examples here that search for partial text strings contained within a range, but I haven't been able to adapt those formulas to my data. wildcards don't seem to work with numbers.

Many thanks for your input, and apologies in advance if I failed to find an existing solution on the site.


回答1:


To match partial numbers inside a number range, like you do with strings, you can use an array formula with INDEX/MATCH, by composing a temporary array that converts the numbers into strings.

Say column A is your 12 digit numbers column, and you want to match the sequence 1234567890 and retrieve the value from column B, This CSE formula works:

=INDEX($B$2:$B$9999, MATCH("*1234567890*",""&$A$2:$A$9999,0))

CtrlShiftEnter

Although you can use full columns A:A and B:B, this should be avoided as much as possible with array formulas, because they're slow. Full columns mean computing and operating arrays of more than a million entries, so avoid it. Also note the "expensive" conversion from numbers to strings (all numbers in the $A$2:$A$9999 are converted to strings here).


To use a cell reference, say D2, instead of the harcoded 1234567890, the formula should be used like this:

=INDEX($B$2:$B$9999,MATCH("*"&D2&"*",""&$A$2:$A$9999,0))


来源:https://stackoverflow.com/questions/44980145/excel-index-match-with-partial-number

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!