+ Reply to Thread
Results 1 to 11 of 11

keep rows aligned with pivot table?

  1. #1
    Forum Contributor
    Join Date
    01-28-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    147

    keep rows aligned with pivot table?

    Hi there,

    After creating a pivot table on a new worksheet(columns A-C), I manually insert text outside of the pivot table (e.g. column D).

    However, when I update the data and click refresh in the pivot table, the text outside the table loses its alignment.

    Is there a way to lock this so if the pivot table data moves rows, the text that is in the same row also moves to stay in line?

    Your help is much appreciated,

    Regards

    N

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: keep rows aligned with pivot table?

    What data is being added outside the table? Can it not be added IN the table as calculated fields? Or added to the raw data so it appears on its own within the table.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: keep rows aligned with pivot table?

    See example in attached workbook

    One way would be to use the Indirect function in combination with Named Ranges based on the values in left column of pivot table
    If you want text against Total rows or rows where the text in left column contains spaces, then use a helper column as in the example - the names of ranges cannot contain spaces. (You can hide the helper column or put in in column Z out of view etc)
    If there are no spaces in the value against which you want text then you do not need to use a helper column

    this removes spaces and is in cell F2:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    this formula is in D2 where you want the text
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Pivot_IndirectFormulaWithHelperColumn.jpg

    set up named ranges

    Pivot_NamedRanges.jpg
    Attached Files Attached Files
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  4. #4
    Forum Contributor
    Join Date
    01-28-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    147

    Re: keep rows aligned with pivot table?

    Hi there,

    Thanks for your help.
    These do work, but I wanted something very basic as the text is updated regularly in column D and there is a lot of data so I cannot afford to do a named range.
    The text cannot be added to the pivot.

    I was thinking there is a simple formula so if you changed the order of the pivot table and had text in column D, this would also automatically move in alignment with the order of the pivot?

    Regards

    N

  5. #5
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: keep rows aligned with pivot table?

    It is a simple formula
    =Indirect(A2)
    Unless there are spaces in the values in columnA

    You simply update the text in the named cell when it changes.

    If anyone can make it simpler than that I'll be impressed

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: keep rows aligned with pivot table?

    If the text added is related to a TEXT field on the same row, then you could accomplish this with a simple VLOOKUP as well if you built a 2-column reference table elsewhere that had the text from the pivot in 1st col and your needed added text in the 2nd column.

    Now use a VLOOKUP to get that text into column D next to your pivot.

    When the pivot updates and rows move around, the vlookup formulas would update as well keeping your text aligned.

    Remember, for a FORMULA solution to work for you in column D, then a formula must exist in column D, meaning it is referencing this information elsewhere.

  7. #7
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: keep rows aligned with pivot table?

    Or another way would be to use INDEX and MATCH formula in column D with a separate lookup table elsewhere with one column an exact match for the relevant values (per column A of the pivot table) and the 2nd column holding the text to display next to the pivot table.
    (which is very similar to JBeaucaire suggestion in post#6)

  8. #8
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: keep rows aligned with pivot table?

    , but I wanted something very basic as the text is updated regularly in column D and there is a lot of data so I cannot afford to do a named range
    Do the values in column A of the pivot table change regularly or are you always selecting from the same set of values? If your set of possible values is constant, a named range would only require setting up once.
    If, on the other hand, the values in column A are a rapidly changing set, then INDIRECT,VLOOKUP or INDEX&MATCH all require the ongoing maintainance of a table that keeps changing..
    Last edited by kev_; 03-19-2017 at 01:47 PM.

  9. #9
    Forum Contributor
    Join Date
    01-28-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    147

    Re: keep rows aligned with pivot table?

    Hi there,

    The values in column A get updated on a daily basis (e.g 4016, 4017,4018 additional rows to 4013,4014 etc).
    They change order, but remain the same.
    I will then have text outside of the pivot (e.g. Thomas in the same row as 4016, Sam in the same row as 4017 etc). But when pivot table is updated, the name in column D will not align.
    Is there away of keeping it aligned without a named range?
    If not I would like help on how to setup a named range please?

    Regards
    N

  10. #10
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: keep rows aligned with pivot table?

    So keeping with our suggestion, you need a reference sheet with a table:
    Data Range
    A
    B
    C
    1
    Code
    Name
    Info
    2
    2013
    Carl
    Dept1
    3
    2014
    Tony
    Dept2
    4
    2015
    Cal
    Dept3
    5
    2016
    Thomas
    Dept4
    6
    2017
    Sam
    Dept5
    7
    2018
    Sid
    Dept6

    With that, you can use a VLOOKUP or INDEX/MATCH to pull in this extra text/info from this static ref sheet.

  11. #11
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: keep rows aligned with pivot table?

    See attached workbook for worked example showing all 3 methods
    (in the workbook itself each of the formulas below are wrapped in IFERROR to keep things pretty)

    INDIRECT & NAMED RANGE
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    VLOOKUP
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    INDEX&MATCH
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    PivotLookUp.jpg

    PivotNamedRanges.jpg
    Attached Files Attached Files

+ 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] How to align duplicate values on different rows and keep corresponding information aligned
    By kashmircentral in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-20-2017, 09:44 AM
  2. [SOLVED] How do I calculate Absolute Value in a cell not aligned with rows used in the array?
    By TIFinance in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-28-2015, 07:27 PM
  3. Mis aligned rows and column
    By lyung in forum Excel General
    Replies: 1
    Last Post: 10-30-2014, 02:06 PM
  4. mis aligned rows and column
    By lyung in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 10-30-2014, 01:51 PM
  5. Imported Data not aligned in excel/table format
    By Jourdanbua in forum Excel General
    Replies: 5
    Last Post: 07-30-2013, 10:00 AM
  6. Match two columns of names while keeping data in rows aligned
    By SpaceWheels in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 03-27-2013, 02:22 PM
  7. Replies: 6
    Last Post: 05-27-2009, 10:55 AM

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