I have been searching to no avail, and want to find an equivalent command (or way) for doing a head()
or tail()
, like in unix, but for excel. And from that command, I would like to be able to grab the first (or last) element of it.
Currently I am just using the MIN
and MAX
command in excel to do this (because my data is currently ordered) but this way does not always work for me when my data comes in different formats.
To get an idea of what I am currently doing, here is a line of code for grabbing the last element of an ordered list in descending order that meets my criteria within the IF statement:
=MIN(IF((C3:C9>F3)*(A3:A9=E3),B3:B9,-99))
So I would basically like to be able to keep the same formula as above, but replace the MIN
with a function that would return the last element (or first) of the rows that meet that IF statement criteria.
I'm not quite familiar with head() or tail() functions, but if you want to return the first or the last value from column B that matches your set of conditions (columns A and C), you can try the following Array formulas (ctrl+shift+enter):
=INDEX(B:B,MIN(IF((C3:C9>F3)*(A3:A9=E3),ROW(B3:B9))))
=INDEX(B:B,MAX(IF((C3:C9>F3)*(A3:A9=E3),ROW(B3:B9))))
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.