Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
543 views
in Technique[技术] by (71.8m points)

excel - 检查Column中是否存在Cell值,然后获取NEXT Cell的值(Check if Cell value exists in Column, and then get the value of the NEXT Cell)

After checking if a cell value exists in a column, I need to get the value of the cell next to the matching cell .

(在检查列中是否存在单元格值之后,我需要获取匹配单元格旁边的单元格的值 。)

For instance, I check if the value in cell A1 exists in column B , and assuming it matches B5 , then I want the value in cell C5 .

(例如,我检查cell A1的值是否存在于column B ,并假设它与B5匹配,那么我想要cell C5的值。)

To solve the first half of the problem, I did this...

(要解决问题的前半部分,我这样做了......)

=IF(ISERROR(MATCH(A1,B:B, 0)), "No Match", "Match")

...and it worked.

(......而且它奏效了。)

Then, thanks to an earlier answer on SO , I was also able to obtain the row number of the matching cell:

(然后,由于早先对SO的回答 ,我还能够获得匹配单元格的行号:)

=IF(ISERROR(MATCH(A1,B:B, 0)), "No Match", "Match on Row " & MATCH(A1,B:B, 0))

So naturally, to get the value of the next cell, I tried...

(很自然地,为了获得下一个细胞的价值,我试着......)

=IF(ISERROR(MATCH(A1,B:B, 0)), "No Match", C&MATCH(A1,B:B, 0))

...and it doesn't work.

(......它不起作用。)

What am I missing?

(我错过了什么?)

How do I append the column number to the row number returned to achieve the desired result?

(如何将列号附加到返回的行号以获得所需的结果?)

  ask by SNag translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

使用不同的函数,如VLOOKUP:

=IF(ISERROR(MATCH(A1,B:B, 0)), "No Match", VLOOKUP(A1,B:C,2,FALSE))

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...