简体   繁体   English

EXCEL - 具有多个条件的搜索公式

[英]EXCEL - Search formula with multiple criteria

Do you know any way to write a formula for vlookup/indexmatch which will look for first result other than "null" for "aaaa", and then for bbb etc?你知道有什么方法可以为 vlookup/indexmatch 编写一个公式,它会为“aaaa”寻找除“null”之外的第一个结果,然后寻找 bbb 等?

I was trying to do that with using multiple if/offsets etc, but its not working.我试图通过使用多个 if/offsets 等来做到这一点,但它不起作用。 在此处输入图片说明

Is it even possible (there can be one row with "aaa" but also 10 on even more).甚至有可能吗(可以有一行带有“aaa”,但也可以有 10 行)。

The following array formula returns the first entry in column B where it is not null and also where column A has cell value aaaaa .以下数组公式返回B列中的第一个条目,该条目不为null并且A列具有单元格值aaaaa

= IFERROR(INDEX(B1:B6,MATCH(1,(A1:A6="aaaaa")*(B1:B6<>"null"),0)),"no match")

Note this is an array formula, so you must press Ctrl + Shift + Enter on the keyboard after typing the formula rather than just pressing Enter .请注意,这是一个数组公式,因此您必须在键入公式后按键盘上的Ctrl + Shift + Enter而不是仅按Enter

To return a similar result except for bbbbb , just replace aaaaa in the above formula with bbbbb .要返回除bbbbb之外的类似结果,只需将上述公式中的aaaaa替换为bbbbb

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM