如何使Excel考虑只有具有给定值的行 [英] How to make Excel consider ONLY rows that have a given value
问题描述
这是一个图像,其次是数据描述
列的描述:
- 列A(Key)是严格增加小数
- 列B(Group)表示A中的值所属的组。
- 列C(数据)是不同的数据
输入(在F列) p>
- F4中的{1,2,3,4}中的精确组号
- 十进制值(无限制),将其称为
DecimalValue
,在F5
任务
查找属于给定组
的行,其中ABS(键
- DecimalValue
)的值被最小化。从该行返回数据
。
- 使用INDEX,VLOOKUP,
ABS等理想的Excel解决方案。
这个问题类似于我以前的问题,但不够(涉及一个新的组
列),通过评论确定最好提出一个新问题,而不是尝试更新/修改现有问题:
添加校正组
列,如果可能的话是我以后的,因此标题反映了这个问题。 >
(不完整的解决方案 - 不考虑组
列)
= INDEX(C4:C33,MATCH(MIN(ABS(A4:A33-F5)),ABS(A4:A33-F5),0))
给这个一个去...似乎在我的测试表上工作。请务必根据您的情况调整范围。同样,这是一个数组公式,需要用Ctrl + Shift + Enter确认:
= INDEX(C2:C7, MAT(((B2:B7 = F4)* A2:A7-F5)),ABS((B2:B7 = F4)* A2:A7-F5),0),0)
它的工作原理是清除不符合您的组分配的键(即(B2:B7 = F4)* A2: A7-F5)部分。所以只有w /有效组的键有一些数字用于匹配数据列。
希望有助于解释它。您还可以使用公式工具栏上的评估公式功能来查看它的作用。
注意:如果使用0作为第一个数据值,它似乎返回第一个数据值最接近的值(不管组选择)。不确定如何解决...
Here is an image, followed by description of data
Description of Columns:
- Column A (Key) is strictly increasing sequence of decimals
- Column B (Group) represents a group the value in A belongs to.
- Column C (Data) is assorted data
Inputs (in column F)
- Exact Group number in i.e. {1, 2, 3, 4} in F4
- A decimal value (unrestricted), call it
DecimalValue
, in F5
Task
Find row that belongs to the given Group
, where ABS(Key
- DecimalValue
) value is minimized. Return Data
from that row.
- Ideally looking for an Excel-only solution, using INDEX, VLOOKUP, ABS, and the like.
This question is similar to my previous question, but different enough (involves a new Group
column), where via comments it was determined that it is best to ask a new question, rather than try to update / modify the existing question:
Display Row Values based on Nearest Numeric Match of Key
Adding correction for Group
column, if it is possible is what I am after, hence the title reflects that concern.
(Incomplete Solution - does not consider Group
column)
=INDEX(C4:C33,MATCH(MIN(ABS(A4:A33-F5)),ABS(A4:A33-F5),0))
Give this a go...it seems to work on my test sheet. Be sure to adjust the ranges to suit your situation. Again, this is an array formula and needs to be confirmed with Ctrl+Shift+Enter:
=INDEX(C2:C7,MATCH(MIN(ABS((B2:B7=F4)*A2:A7-F5)),ABS((B2:B7=F4)*A2:A7-F5),0),0)
It works by zeroing out keys that don't match your group assignment (that's the (B2:B7=F4)*A2:A7-F5) part. So only keys w/ valid groups have some number to be used to match to the data column.
Hope that helps explain it. You can also utilize the "Evaluate Formula" function on the Formulas toolbar to see it in action.
Note - it seems to return the 1st data value if 0 is used as the closest value (regardless of group selection). Not sure how to get around that...
这篇关于如何使Excel考虑只有具有给定值的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!