[英]Finding a specific cell contanining value greater than the desired value
I'm looking for a way to return a specific cell value from a range based on an initial desired value. 我正在寻找一种基于初始期望值从范围返回特定单元格值的方法。 It looks like this:
看起来像这样:
DesiredValue typed in cell: | 125|
Search Range: 搜索范围:
line1 RangeA|RangeB
line2 1 | 50
line3 51 | 100
line4 101 | 500
line5 501 | 1500
I'm trying to get two formulas: 我试图得到两个公式:
the first one returns the immediate bigger value in rangeA (500 in this case), the second one returns the immediate lower value (101 in this case). 第一个返回rangeA的立即较大值(在这种情况下为500),第二个返回立即较低的值(在这种情况下为101)。
Currently I'm using a very ugly if formula, for the greater value as an example: 当前,我使用一个非常难看的if公式,以更大的值为例:
if[DesiredValue]<=[b2], [B2], if [DesiredValue]<=[b3], [b3], if...
A modified version of this formula is used to get the lower number, but it is really not the way to do it since i'm gonna have to use it in a couple hundread ranges. 该公式的修改版本用于获取较低的数字,但实际上并不是这样做的方法,因为我将不得不在几个Hundread范围内使用它。
Thanks in advance! 提前致谢!
With 125 typed into D2 the first will return 101 from Range A ; 将125输入D2时,第一个从范围A返回101 ; the second will return 500 from Range B .
第二个将从范围B返回500 。
=INDEX(A:A, MATCH(D2, A:A))
=INDEX(B:B, MATCH(D2, A:A))
This method is known as a INDEX / MATCH function pair. 此方法称为INDEX / MATCH函数对。
When seeking approximate matches, the values to be examined must be in ascending order as yours are. 在寻求近似匹配时,要检查的值必须按照您的升序排列。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.