简体   繁体   English

vlookup - 仅返回带有文本的单元格

[英]vlookup - only return cell with text

I need to return a cell that has text in it, but am running into difficulty. 我需要返回一个包含文本的单元格,但遇到了困难。

在此输入图像描述

Above is a sample table I'm working with. 以上是我正在使用的示例表。 What I'd like to be able to do, is lookup id 1 and have it output Rich. 我希望能够做的是查找ID 1并将其输出Rich。 When I do a vlookup, however, it gives no output. 但是,当我执行vlookup时,它没有输出。 And while vlookup min/max will output integers, they don't work with text. 虽然vlookup min / max将输出整数,但它们不适用于文本。 Does anyone know how I can scan multiple ids, but only output the filled text cell? 有谁知道我如何扫描多个ID,但只输出填充的文本单元格?

There may be a shorter formula for this but I banged this off quickly and it does dynamically truncate the ranges in column B down to the minimum number of rows necessary. 可能有一个较短的公式,但我迅速将其关闭,它会动态地将B列中的范围截断到必要的最小行数。

=INDEX(B:B, AGGREGATE(15, 6, ROW(B2:INDEX(B:B, MATCH("zzz",B:B )))/(ISTEXT(B2:INDEX(B:B, MATCH("zzz",B:B )))*(A2:INDEX(A:A, MATCH("zzz",B:B )))=D3), 1))

index_aggregate_rich

To retrieve a second, third, etc. entry change the k parameter of AGGREGATE to a COUNTIF and fill down. 要检索第二个,第三个等条目,请将AGGREGATE的k参数更改为COUNTIF并填写。

=INDEX(B:B, AGGREGATE(15, 6, ROW(B$2:INDEX(B:B, MATCH("zzz",B:B )))/(ISTEXT(B$2:INDEX(B:B, MATCH("zzz",B:B )))*(A$2:INDEX(A:A, MATCH("zzz",B:B )))=D3), COUNTIF(D$3:D3, D3)))

index_aggregate_rich2

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

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