Forum Discussion
Marc_Kim
Sep 26, 2023Copper Contributor
How can get a value of the first row according to filter selection?
Hi all,
I would like to get first row of text every time I filter row.
e.g. when Update Period selected 2023-06, then capture the first row# 22.
when Update Period selected 2023-07, then capture the first row# 97.
If I use offset function, it always capture row#22 no matter what I filter.
Is there any tip for this pls?
- SanthoshKunderIron Contributor
Marc_Kim - How about a helper column with COUNTIF formula?. Filter only 1 gives you the first result from the list of values.
Slightly depends on Excel version you use, practically for any one:
Also with Helper column with formula as
=AGGREGATE(3,5,B3)
It returns zero for hidden rows and 1 for visible one.
With that in F2
=INDEX( data, MATCH(1, helper, 0), 1)
and similar in G2, etc. Here main range is named as data and helper accordingly.
- Patrick2788Silver Contributor
A 365 solution.
=LET( VisibleOnly, LAMBDA(element, IF(SUBTOTAL(3, element) = 1, element, "")), visible, MAP(Table1, VisibleOnly), filtered, FILTER(visible, TAKE(visible, , 1) <> ""), TAKE(filtered, 1) )