Get first filtered cell in a row

Cowichandave

New Member
Joined
Jan 18, 2009
Messages
44
Office Version
  1. 2016
Is it possible with a filtered table to get a specific cell say b10 from the first row and have it display elsewhere and if the filter changes the cell would change with it.
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Yes, but you'd need to run some VBA to make it work. Is VBA an option for you?
 
Upvote 0
Here's the basic idea ...

AB
1NameValue
2A2
3B3
4C5
5D7
6E11
7F13
8G17
Sheet1

ABCD
1
2First value2
3
4Subtotal58
5
Sheet2
Cell Formulas
RangeFormula
C4C4=SUBTOTAL(9,FilteredValues)
Named Ranges
NameRefers ToCells
FilteredValues=Sheet1!$B$2:$B$8C4

FirstValue:=Sheet2!$C$2

VBA Code:
'In Sheet2 module
Private Sub Worksheet_Calculate()

    Range("FirstValue") = Sheet1.Range("FilteredValues").SpecialCells(xlCellTypeVisible)(1).Value
  
End Sub

To detect the change in filter in Sheet1, I have put a SUBTOTAL() formula in Sheet2 and used the Worksheet_Calculate event. You could put this somewhere else (quiet) in the workbook to minimise calls to Worksheet_Calculate.

1702103539885.png
-------->
1702103500682.png
 
Upvote 0
Formula to show first row of Table

First result is with filter Select All
Second result with filter Select C

T202312a.xlsm
AB
1
2First 2
3
4NameValue
5A2
6B3
7A5
8A7
9C11
10C13
11C17
12
3b
Cell Formulas
RangeFormula
B2B2=LET(c,B5:B9999,TAKE(FILTER(c,BYROW(c,LAMBDA(br,SUBTOTAL(3,br)))=1),1))


Filter or First Row of unfiltered
T202312a.xlsm
AB
2C11
3
4NameValue
9C11
10C13
11C17
3b
Cell Formulas
RangeFormula
A2:B2A2=LET(c,A5:A9999,TAKE(FILTER(c,BYROW(c,LAMBDA(br,SUBTOTAL(3,br)))=1),1))
 
Last edited:
Upvote 0
Another formula solution for xl 2016 using a helper column.
Fluff.xlsm
ABCD
1
2Forest of Dean
3
4CountyDistrictWardIs visible
13GloucestershireForest of DeanCinderford East1
14DorsetWest DorsetMaiden Newton1
20Greater ManchesterTamesideHyde Werneth1
25CornwallCornwallRoche1
26West YorkshireKirkleesHolme Valley North1
Sheet5
Cell Formulas
RangeFormula
B2B2=INDEX(B5:B100,MATCH(1,D5:D100,0))
D13:D14,D20,D25:D26D13=SUBTOTAL(103,A13)
 
Upvote 0
Another formula solution for xl 2016 without using a helper column.

23 12 11.xlsm
ABC
1
2Forest of Dean
3
4CountyDistrictWard
13GloucestershireForest of DeanCinderford East
14DorsetWest DorsetMaiden Newton
20Greater ManchesterTamesideHyde Werneth
25CornwallCornwallRoche
26West YorkshireKirkleesHolme Valley North
27
Sheet2 (2)
Cell Formulas
RangeFormula
B2B2=INDEX(B5:B100,MATCH(1,SUBTOTAL(3,OFFSET(B5,ROW(B5:B100)-ROW(B5),,1)),0))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Forum statistics

Threads
1,215,261
Messages
6,123,930
Members
449,134
Latest member
NickWBA

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top