+ Reply to Thread
Results 1 to 12 of 12

Dynamic Named Range based on Pivot Table

  1. #1
    Registered User
    Join Date
    07-11-2012
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    69

    Dynamic Named Range based on Pivot Table

    Is there any way to update the ranges in the "Named Ranges" section so that if a new value inserts, it would automatically update the "Named Ranges"?

    For example, current "Named Ranges" under "Colour" includes A5:A16. Any way that it could automatically update the named range "colour" from A5:A17 if a new value is updated in the Pivot?


    See attached sample file please! VBA or non-VBA solution would be helpful.


    Thanks!

    Pho6
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Dynamic Named Range based on Pivot Table

    So why dont you split the data into multiple columns, so Colour, Cost, Names, size all have a different column of data, then you can easily make a dynamic named range on a pivot table for each?

    I do not recommend having one column for multiple data dimensions in a data set.

    If you had them in a different column you could make a pivot for each one that simply lists them all, and use THAT with offset and countA to get the list you are wanting.
    Please ensure you mark your thread as Solved once it is. Click here to see how.
    If a post helps, please don't forget to add to our reputation by clicking the star icon in the bottom left-hand corner of a post.

  3. #3
    Registered User
    Join Date
    07-11-2012
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    69

    Re: Dynamic Named Range based on Pivot Table

    Because the data that I have actually automatically refreshes from an external source and the output is produced that way onto excel...

  4. #4
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Dynamic Named Range based on Pivot Table

    fail. Will they always be in that layout? colour above cost above name above size?

  5. #5
    Registered User
    Join Date
    07-11-2012
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    69

    Re: Dynamic Named Range based on Pivot Table

    Yup they will always be in that order. Just need to somehow dynamically change the range if a value under it gets added.

    I was thinking maybe if somehow with a VBA which can identify a break somehow between rows? It's killing me.

  6. #6
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Dynamic Named Range based on Pivot Table

    Its easy, and there are plenty of ways to do it, but if you wanted to do it with VBA, I would say use the vba to standardize the data like I said above :D

    To get to what you are trying to accomplish check out the following file. I used helper cells so you can walk through what I am doing, but you could house ALL of those formulas IN the formula for the named ranges if you would like. I typically like it split out, as it is easier to audit since you cant walk through the formulas in the name manager.

    Let me know if you have any questions.

    TestFile.xlsx

  7. #7
    Registered User
    Join Date
    07-11-2012
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    69

    Re: Dynamic Named Range based on Pivot Table

    Thanks - I'm going to play around with this and see if it works.

  8. #8
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Dynamic Named Range based on Pivot Table

    Oh, also note the dynamic named range I made for your PivotTableData called PivotDATA. It will grow as your column A grows and as your Row 1 grows, dynamically/automatically.

    Then just refresh your pivot table and the dynamic named ranges will also adjust automatically.

  9. #9
    Registered User
    Join Date
    07-11-2012
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    69

    Re: Dynamic Named Range based on Pivot Table

    This worked perfectly. Thanks so much!

  10. #10
    Registered User
    Join Date
    07-11-2012
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    69

    Re: Dynamic Named Range based on Pivot Table

    Hi MikeTron - is it possible to add another dimension to the dynamic range and make it two columns?

    TestFile3.xlsx

  11. #11
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Dynamic Named Range based on Pivot Table

    Yes it is possible. You need to use the column width portion of the offset function.

    Also, I don't know what you are trying to do but that is a kinda clunky solution. You could just as easily have VBA come and fix a named range, then update it anytime a pivot gets refreshed in the background.

    You can see the new additional 2 column width named ranges labeled VlookupShirt/Computer/Fruit in the attached file.

    TestFile4 with new names ranges.xlsx

  12. #12
    Registered User
    Join Date
    07-11-2012
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    69

    Re: Dynamic Named Range based on Pivot Table

    thanks so much!

+ 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. Dynamic range names based on pivot table fields?
    By Gandalf21 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-23-2013, 07:47 PM
  2. Dynamic range names based on pivot table fields?
    By Gandalf21 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-23-2013, 11:47 AM
  3. Replies: 1
    Last Post: 12-16-2011, 08:08 PM
  4. Pivot table based on named (non-contiguous) range
    By kuraitori in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-05-2010, 12:29 PM
  5. Replies: 0
    Last Post: 09-11-2006, 10:40 PM

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