简体   繁体   English

(谷歌表格或excel)如何在当前单元格上方找到最接近的匹配值,并在同一行中返回不同的列?

[英](google sheets or excel) How can I find the closest matching value above the current cell, and return a different column in that same row?

I asked this question here , but I've hit another roadblock.在这里问了这个问题,但我遇到了另一个障碍。 I've included a visual below of what I'm trying to achieve.我在下面包含了我要实现的目标的视觉效果。

理想结果的例子

For any row where Column A=x, just return the value in Column B to Column "Results".对于 A 列 = x 的任何行,只需将 B 列中的值返回到“结果”列。 If Column A does not equal x, I want to return the closest (in distance) Column B value above the current row where Column A=x and Column B is any 3 digit number.如果 A 列不等于 x,我想返回当前行上方最近(距离)的 B 列值,其中 A 列 = x,B 列是任何 3 位数字。 The first part (where Column A=x) is simple, but I'm having trouble with the second part, where Column A <> x.第一部分(列 A=x)很简单,但我在第二部分遇到问题,列 A <> x。 In the linked question, I was able to use the solution to find the closest value above the current cell where Column A=x, but I have not been able to figure out how to find the closest value above the current cell where Column A=x AND Column B is any 3 digit number.在链接的问题中,我能够使用该解决方案找到列 A=x 的当前单元格上方的最接近值,但我无法弄清楚如何找到列 A= 的当前单元格上方的最接近值x AND B 列是任意 3 位数字。 Any suggestions would be much appreciated!我们欢迎所有的建议! Thank you!谢谢!

try:尝试:

=INDEX(IF(B:B="",, VLOOKUP(ROW(B:B), 
 IF(ISNUMBER(1*B:B)*(LEN(B:B)=3), {ROW(B:B), B:B}), 2, 1)))

ISNUMBER will check for the digits and LEN will check for 3 numbers ISNUMBER将检查数字, LEN将检查 3 个数字

暂无
暂无

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

相关问题 如何在当前单元格上方找到最接近的匹配值,并在同一行中返回不同的列? - How can I find the closest matching value ABOVE the current cell, and return a different column in that same row? 从与另一个单元格的同一行但不同列对应的单元格中检索数字值(谷歌表格) - Retrieve a number value from a cell corresponding to the same row but different column of another cell (Google Sheets) 如果 FILTER 的值与 Google Sheets 中的上述行不同,如何使用 FILTER 返回行? - How to use FILTER to return rows if its value is different than the above row in Google Sheets? 我有一个包含 5 个不同文本(来自下拉列表)的 google 表格单元格 - 如何让另一个单元格根据文本返回一个值 - I have a google sheets cell with 5 different texts (from a dropdown) - how can I make another cell return a value based on the text 如何让 Google 表格在数值列中找到等于或高于数值的一审? - How do I get Google Sheets to Find First Instance at or above a Numerical Value in a Column of Values? 在 Google 表格中,当您知道查找列名称和结果列名称时,如何在一行的列中找到值? - In Google Sheets, how can I find the value in a column of a row when you know the lookup column name and result column name? Google表格条件格式基于同一列中上方3行的单元格值 - Google Sheets conditional formatting based on cell value 3 rows above in same column 如何在Google表格的列中的每第N行插入一个具有值的单元格 - How to insert a cell with value on every Nth row in a column in Google Sheets Google Sheets:在一行中查找最后一个非空单元格并从不同行中提取单元格值 - Google Sheets: Find last non empty cell in a row and extract cell value from different row Google 表格:如何根据匹配整个范围的列返回文本值? - Google sheets: How do I return a text value based on a column matching an entire range?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM