[英]Excel function to find nth to last non blank value in a row
I have a sheet filled with blood pressure (BP) data, arranged by month.我有一张按月排列的充满血压 (BP) 数据的表格。
I am interested in storing the last three BP values in a range per patient, each of which is assigned a row.我有兴趣将最后三个 BP 值存储在每个患者的范围内,每个值都分配了一行。 Note that there are months which do not have BP readings, so there are blanks in the dataset.
请注意,有些月份没有 BP 读数,因此数据集中存在空白。
The range for the blood pressures is BB:BL
.血压的范围是
BB:BL
。
I was able to find formulas for the last:我能够找到最后的公式:
=LOOKUP(2,1/(ISNUMBER(BB3:BL3)),BB3:BL3)
and second-to-last:和倒数第二:
=LOOKUP(9.99E+307,BB3:INDEX(BB3:BL3,MATCH(9.99E+307,BB3:BL3)-1))
But I am not able to modify the formula above to find the third-to-last non-blank BP value.但是我无法修改上面的公式来找到倒数第三个非空白 BP 值。
Any advice is appreciated!任何建议表示赞赏!
To find the third-to-last non-blank value, try using INDEX+AGGREGATE function要查找倒数第三个非空值,请尝试使用 INDEX+AGGREGATE 函数
1] For data range placed in vertically 1] 对于垂直放置的数据范围
In C2
, enter formula :在
C2
,输入公式:
=INDEX(A1:A100,AGGREGATE(14,6,ROW(A1:A100)/(A1:A100<>""),3))
2] For data range placed in horizontally 2]对于水平放置的数据范围
In B3
, enter formula :在
B3
,输入公式:
=INDEX(1:1,AGGREGATE(14,6,COLUMN(1:1)/(1:1<>""),3))
2.a] If the data range placed in a specified position, eg BB3:BH3 2.a] 如果数据范围放置在指定位置,例如 BB3:BH3
The formula become, in B3
formula : >>公式变成,在
B3
公式中:>>
=INDEX(BB3:BH3,AGGREGATE(14,6,COLUMN(BB3:BH3)-COLUMN(BA3)/(BB3:BH3<>""),3))
Remark : the Column number must adjusted to COLUMN(BB3:BH3)-COLUMN(BA3)
in become {1,2,3,4,5....}备注:列号必须调整为
COLUMN(BB3:BH3)-COLUMN(BA3)
才能变为 {1,2,3,4,5....}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.