+ Reply to Thread
Results 1 to 6 of 6

Dynamic formula range for SORTBY and INDEX/XMATCH into a pivot table

  1. #1
    Registered User
    Join Date
    10-28-2019
    Location
    Brussels, Belgium
    MS-Off Ver
    Office 365
    Posts
    21

    Dynamic formula range for SORTBY and INDEX/XMATCH into a pivot table

    Hi everyone,

    I have a problem when it comes to automatically updating an excel report using SORTBY dynamic ranges (attached excel).

    There is a pivot table which everytime there is an update, a new column will be added for a new year (e.g. next year will be 2022 on column Q).

    Below the pivot I have a clean report which uses INDEX/XMATCH to retrieve the values for "Other sources" which I always want to keep on top of the clean report, and below the "INDEX/XMATCH" formula I have a SORTBY that retrieves all values and sorts them by the LATEST YEAR (currently 2021).

    My desired outcome is to not have to drag the INDEX/XMATCH formula to the next column, and to not have to update the formula range inside the SORTBY cell once a new year is added (basically I would need to expand the SORTBY range and also specify that the sort should be based on 2022 column, not 2021).

    Could someone kindly walk me through how I can achieve this? I have 0 clue where to even begin...

    Many thanks!
    B
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,108

    Re: Dynamic formula range for SORTBY and INDEX/XMATCH into a pivot table

    How about
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,137

    Re: Dynamic formula range for SORTBY and INDEX/XMATCH into a pivot table

    IMHO.... cut out the middle man and go directly to source. Why do you need the Pivot Table at all? It is (probably) easier to make a dynamic formula from the raw data. Can you attach a raw data sample... as your current sample is not a real PT... as the underlying data are not available.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  4. #4
    Registered User
    Join Date
    10-28-2019
    Location
    Brussels, Belgium
    MS-Off Ver
    Office 365
    Posts
    21

    Re: Dynamic formula range for SORTBY and INDEX/XMATCH into a pivot table

    I would have done that, but I created a lot of (required) reclassification columns in power query/pivot in order to arrive at a column needed => which was in turn used in the pivot.

    My base dataset is quite raw and would not allow a direct reference to it, but good idea for another case!

  5. #5
    Registered User
    Join Date
    10-28-2019
    Location
    Brussels, Belgium
    MS-Off Ver
    Office 365
    Posts
    21

    Re: Dynamic formula range for SORTBY and INDEX/XMATCH into a pivot table

    Quote Originally Posted by Fluff13 View Post
    How about
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Superb job, that worked! I will analyze the formula to figure out exactly how you did it because I am not familiar with LET, so that I can replicate it into the future.

    Many thanks!!

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,108

    Re: Dynamic formula range for SORTBY and INDEX/XMATCH into a pivot table

    Glad to help & thanks for the feedback.

+ 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. Inserting SORTBY formula in range does not work
    By ABSTRAKTUS in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-19-2020, 11:41 AM
  2. Replies: 14
    Last Post: 09-28-2019, 10:32 PM
  3. [SOLVED] Pivot Table DataBodyRange for a dynamic range selection in Cell Formula
    By SMCC in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-04-2018, 01:57 PM
  4. Pivot table formula with dynamic range
    By tpollard1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-09-2016, 04:13 PM
  5. Dynamic range for pivot table
    By Chemistification in forum Excel General
    Replies: 3
    Last Post: 10-28-2009, 12:44 PM
  6. Dynamic range for pivot table
    By jhangey in forum Excel General
    Replies: 1
    Last Post: 04-03-2009, 07:35 PM
  7. Dynamic Pivot Table Range
    By cc212760 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-13-2008, 07:22 AM

Tags for this Thread

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