+ Reply to Thread
Results 1 to 5 of 5

Button to filter data based on changing value of another cell

  1. #1
    Registered User
    Join Date
    06-02-2025
    Location
    Scotland
    MS-Off Ver
    365
    Posts
    2

    Question Button to filter data based on changing value of another cell

    Is it possible to assign an action to a button so that it filters data based on the value next to the button, which itself updates based on selected slicers?

    So for example, slicers Jan and 2025 are selected which control a pivot table, and then another sheet lists the top 10 sales, basically returning the first ten entries of the pivot table which is sorted by size largest to smallest.

    I have a button next to each of the 10 entries. I want to click, say button 6, and this will filter the data in another tab to show all occurrences of whatever is next to button 6 at that point in time. So if “cheese” is next to button 6, then I want the user to be transported to the data tab which is now filtered by product type “cheese”.

    Hope that makes sense!

  2. #2
    Valued Forum Contributor
    Join Date
    03-05-2025
    Location
    Deutschland
    MS-Off Ver
    MS Office Home & Business 2024
    Posts
    487

    Re: Button to filter data based on changing value of another cell

    Hi,

    welcome to the forum.

    Please load you sample file, so we can understand exactly what do you mean...

    BR, Alexandra

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,450

    Re: Button to filter data based on changing value of another cell

    Hi speedy and welcome to the forum,

    I'm invisioning having a sheet with an Advanced Filter on it, filtering another sheet's Data. In VBA you click on a number and the data next to another table is used to fill in the criteria for the Advanced Filter, which then fills in the sheet. In the newer Excel Spill functions you can do this with a single formula.

    All we really need is a sample workbook, showing what your data looks like and the slicers, etc. It even seems this can be done without any VBA using the newer Spill functions. We can't be for sure without seeing what you really mean by your question. Learn how to attach a sample workbook to this thread and we can give a much better answer.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Registered User
    Join Date
    06-02-2025
    Location
    Scotland
    MS-Off Ver
    365
    Posts
    2

    Re: Button to filter data based on changing value of another cell

    Dash Test Mockup.xlsm

    Thanks for the welcomes

    My actual spreadsheet has confidential information so I've recreated the basic essence of it in the attached version.

    I've recorded a macro to show what I would want to happen if the "1" button on the list (on the Dash tab) is clicked, though this is based on me knowing that "D Green" is first when no slicers are selected.

    When a slicer is selected and the order changes, I would want the "1" button to filter the Data tab by whatever name is now next to it, and same for the other buttons.

  5. #5
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,450

    Re: Button to filter data based on changing value of another cell

    Hi speedy,

    You could create and assign a macro for each button (see attached where I've done 2 and 3) or you could use a Double Click Event on the Name itself and pass that parameter to the code that does the work. See it in the attached also after reading this link.
    https://www.bing.com/search?q=vba+pa...tsg=1&hsmssg=0

    I prefer doing a double click on the name itself so I don't need to create lots of buttons and then try to figure out what might be to the right of them.
    See if this works for you.

    Also watch https://www.youtube.com/watch?v=DxIzTKgchJ8 and the Sheet Code Name for more hints on learning VBA.
    Attached Files Attached Files
    Last edited by MarvinP; 06-04-2025 at 10:47 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Help with changing Pivot table filter based on cell Value
    By rv02 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-11-2020, 04:21 AM
  2. Update a pivot filter based on cell value by using a button
    By tray262 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 08-23-2013, 02:40 PM
  3. Changing the text on button based on cell content
    By a94andwi in forum Excel General
    Replies: 1
    Last Post: 06-11-2009, 12:58 PM
  4. Changing cell content based on button
    By vioravis in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-14-2008, 04:16 PM
  5. Changing Auto Filter Based on User Inputted Cell
    By JohnGuts in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 04-07-2007, 05:33 PM
  6. Formula for changing a cell based on a filter.
    By darkunderdog in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-03-2006, 10:11 PM
  7. Changing Command Button Based on Data Entry
    By Bill in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-20-2006, 06:35 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1