Click on a cell - acts like a filter

santa12345

Board Regular
Joined
Dec 2, 2020
Messages
66
Office Version
  1. 365
Platform
  1. Windows
Hello. I am trying to click on a single cell...and all the similar values (to the cell I clicked) .. those results return on a separate tab.
Please see attachment. Only issue is..my real data has 1000 of entries vs. my sample
 

Attachments

  • Untitled.jpg
    Untitled.jpg
    74.8 KB · Views: 8

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Open a COPY of your workbook. Right click on the sheet tab on the bottom of the sheet with your table and select "View Code". Paste the following code into the window that opens:

VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rng As Range, c As Long, v As Variant, n As Variant

    Set rng = Range("A2:C13")
    
    If Intersect(Target, rng) Is Nothing Then Exit Sub
    If Target.Cells.Count > 1 Then Exit Sub
    c = Target.Column - rng.Column + 1
    v = Target.Value
    v = IIf(IsNumeric(v), v, """" & v & """")
    n = Evaluate("FILTER(" & rng.Address & ",INDEX(" & rng.Address & ",0," & c & ")=" & v & ")")
    
    Worksheets("Sheet6").Cells.ClearContents
    Worksheets("Sheet6").Range("A1").Resize(UBound(n), rng.Columns.Count).Value = n
    Worksheets("Sheet6").Activate
    
End Sub

Change the range in the top line to your table. Change "Sheet6" in the last 3 lines to be the sheet where you want the filtered list. The last line switches to that sheet, you can remove that if you don't want it.

Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,216,119
Messages
6,128,947
Members
449,480
Latest member
yesitisasport

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