I have a sheet filled with blood pressure (BP) data, arranged by month.
I am interested in storing the last three BP values in a range per patient, each of which is assigned a row. Note that there are months which do not have BP readings, so there are blanks in the dataset.
The range for the blood pressures is 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.
Any advice is appreciated!
To find the third-to-last non-blank value, try using INDEX+AGGREGATE function
1] For data range placed in vertically
In C2
, enter formula :
=INDEX(A1:A100,AGGREGATE(14,6,ROW(A1:A100)/(A1:A100<>""),3))
2] For data range placed in horizontally
In B3
, enter formula :
=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
The formula become, in B3
formula : >>
=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....}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.