Looping a function for multiple lookups

前端 未结 1 1135
清歌不尽
清歌不尽 2020-12-11 12:10

I\'m trying to write a formula that search for a part number in a different sheet, and imports all of the times the part had failed inspection. The problem is that I have mu

相关标签:
1条回答
  • 2020-12-11 12:37

    You can retrieve a multiple match using the AGGREGATE function to force anything that does not match into an error and ignore the errors.

    =INDEX('QN Data'!$A$3:$A$10000, AGGREGATE(15, 6, ROW($1:$9998)/('QN Data'!$D$3:$D$10000=$B$4), ROW(1:1)))
    

    You are actually using the SMALL sub-function of the AGGREGATE function so you can get the second, third, etc. successive matches by increasing the k paramter. I done this above by using ROW(1:1) which equals 1 but will increase to 2, 3, etc as the formula is filled down.

    The relative row position within 'QN Data'!$A$3:$A$10000 is returned by forcing any row position that does not match into a #DIV/0! error state. The 6 option tells AGGREGATE to ignore errors.

    You may wish to put an IFERROR function around the formula so that you can fill down for more rows than necessary without showing #NUM! errors when you run out of matches.

    0 讨论(0)
提交回复
热议问题