+ Reply to Thread
Results 1 to 5 of 5

Swapping some column headers with values in another column

  1. #1
    Registered User
    Join Date
    05-07-2020
    Location
    Ottawa, Canada
    MS-Off Ver
    2016
    Posts
    2

    Swapping some column headers with values in another column

    Hello,
    I have a workbook that records Department, Employee Classification, and Project as columns with each project being its own column. The purpose of the sheet is to track salary expenditures of a given department for a given employee class for a given project. Employee classifications can repeat within its column given that multiple departments can have employees belonging to the same class. I want to have it so that the employee classifications each have their own column rather than the projects and the projects take the place of where the employee classifications are now. In the attachment I've provided an example of what the end result should look like in Sheet2. How would I go about making this alteration?
    Attached Files Attached Files

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Swapping some column headers with values in another column

    give this a try in sheet2 cell C2 dragged across then down...
    =SUMPRODUCT((Sheet1!$A$2:$A$10=Sheet2!$A2)*(Sheet1!$C$1:$E$1=Sheet2!$B2)*(Sheet1!$B$2:$B$10=Sheet2!C$1),Sheet1!$C$2:$E$10)
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,882

    Re: Swapping some column headers with values in another column

    Employing Power Query, I unpivoted your table and loaded it back to Excel where I then created a Pivot Table. All is shown in the attached file. In power query, the Mcode to unpivot your table is shown below.
    Please Login or Register  to view this content.
    If you are unfamiliar with Power Query, then click on one of the links in my signature block.
    Attached Files Attached Files
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Registered User
    Join Date
    05-07-2020
    Location
    Ottawa, Canada
    MS-Off Ver
    2016
    Posts
    2

    Re: Swapping some column headers with values in another column

    That did it! Thank you so much!

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,882

    Re: Swapping some column headers with values in another column

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, as a relatively new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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 reference row values using column headers
    By MyStix01 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-16-2018, 01:47 AM
  2. [SOLVED] Returning Column Headers for Max Values with Ties
    By JHansee in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-12-2017, 10:00 AM
  3. Retrieve Column Headers Dynamically - Based on column Values
    By akshaysudhir in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-12-2016, 05:42 AM
  4. [SOLVED] listbox with column headers as a specific sheet column headers
    By ANDREAAS in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-07-2014, 04:40 AM
  5. How to return column headers for where certain values appear in each row
    By gc-spurs in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 03-16-2014, 07:05 PM
  6. [SOLVED] Cell Values Become Column Headers
    By nalani24 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-05-2013, 03:35 PM
  7. Replies: 2
    Last Post: 05-09-2012, 01:30 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