简体   繁体   English

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

[英]How can I find the closest matching value ABOVE the current cell, and return a different column in that same row?

Working in google sheets, I am trying to find the closest matching value ABOVE the current cell and return a different column from that same row.在谷歌表格中工作,我试图找到当前单元格上方最接近的匹配值,并从同一行返回不同的列。

Here is a visual 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 where Column A=x above the current row.如果 A 列等于 x,我想返回最接近(距离上)的 B 列值,其中 A 列 = x 在当前行上方 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。 I've tried various iterations of index match, vlookup, but I keep ending up with either the first or last match, rather than the closest (in distance) above.我已经尝试了索引匹配、vlookup 的各种迭代,但我一直以第一个或最后一个匹配结束,而不是上面最近的(距离上)。

Thank you so much!非常感谢!

Try LOOKUP :尝试LOOKUP

=ArrayFormula(LOOKUP(1,1/($A$1:A1="x"),$B$1:B1))

在此处输入图片说明

try:尝试:

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

在此处输入图片说明

暂无
暂无

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

相关问题 (谷歌表格或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? 按同一行和上面的行中的条件返回单元格值 - Return cell value by criteria in same row AND row above 基于将不同的单元格值与列标题进行匹配,从而对行中的单元格进行格式化 - Formatting a cell in a row based on matching a different cell value with a column header 如何根据必须与返回值在同一行中指定的范围匹配的百分比查找列值? - How can I lookup a column value based on a percentage that must match a range specified in the same row as the return value? 查找最小数值并返回不同行中的单元格 - Find minimum numeric value and return cell in different row 根据 2 个条件,在当前行上方的所有行中查找某个值是否存在于某个列的 Google 工作表中 - Find if a value exists in a Google sheet on a certain column, in all the rows above the current row based on 2 criterias 如何计算第 1 列并在第 2 列返回当前行及以上行的特定 ID 号的结果? - How to count column 1 and return result in column 2 for specific ID numbers for current row and above? 查找单元格匹配值并返回行号 - Find Cell Matching Value And Return Rownumber 如何找到一行,找到该行中的最大值并返回该列标题? - How do I find a row, find the highest value in that row, and return that column header? 如何在当前单元格上方找到最近的非空白单元格? - How to find nearest non-blank cell above the current cell?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM