+ Reply to Thread
Results 1 to 11 of 11

Formula to format source data correctly for Pivot table

  1. #1
    Registered User
    Join Date
    04-20-2023
    Location
    berlin
    MS-Off Ver
    16.72
    Posts
    3

    Post Formula to format source data correctly for Pivot table

    Hello,

    I have a table which is not formatted correctly for applying pivot.
    Can you please share the formula for converting the table to the correct format so that I can use it as a source table for pivot analysis?
    Sample data and the expected format are attached.


    Thanks in advance for your help!
    Attached Files Attached Files
    Last edited by nachiket911; 04-22-2023 at 01:04 PM.

  2. #2
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Cool Re: Formula to format source data correctly for Pivot table

    is that what you want?

  3. #3
    Registered User
    Join Date
    04-20-2023
    Location
    berlin
    MS-Off Ver
    16.72
    Posts
    3

    Re: Formula to format source data correctly for Pivot table

    Thank you but I want the Excel formula to do it.
    This is sample data but I have a lot more rows and columns.
    How to use =INDEX formula to arrange the data in this format?

  4. #4
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Formula to format source data correctly for Pivot table

    If you want formula you'll need to wait for someone else

    Have a nice day

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,906

    Re: Formula to format source data correctly for Pivot table

    Please manually mock up what you want.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  6. #6
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,005

    Re: Formula to format source data correctly for Pivot table

    A15
    =IF(ROWS($A$15:A15)>12*ROWS($A$2:$A$11)/2,"",INDEX($1:$1,,(ROWS($A$15:A15)-1)*2/ROWS($A$2:$A$11)+3))

    B15
    =IF($A15="","",INDEX($A:$A,MOD((ROWS($A$15:A15)-1)*2,ROWS($A$2:$A$11))+2))

    C15
    =IF($A15="","",INDEX($1:$100,MOD((ROWS($A$15:A15)-1)*2,ROWS($A$2:$A$11))+2,(ROWS($A$15:A15)-1)*2/ROWS($A$2:$A$11)+3))

    D15
    =IF($A15="","",INDEX($1:$100,MOD((ROWS($A$15:B15)-1)*2,ROWS($A$2:$A$11))+3,(ROWS($A$15:B15)-1)*2/ROWS($A$2:$A$11)+3))

    copied down.
    Attached Files Attached Files

  7. #7
    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,055

    Re: Formula to format source data correctly for Pivot table

    nachiket911,

    Hi. Before we get going on this one...

    Is your forum profile showing the Excel PRODUCT that you need this request to work with? 16.72 >>>might<<< be something for a Mac. I don't know.

    The best solutions often rely on knowing WHICH Office PRODUCT (Excel, NOT Windows) that you have. Please check that your forum profile is up-to-date. If you aren't sure, in Excel go to File/Account and report what it says below the MS logo at the top of that page. If your version is for Mac, please also state this.

    The three most recent Excel PRODUCTS are Excel 2019, Excel 2021 and MS365 - if you are using MS365, please give this name along with the Version number in your profile (e.g. MS365 (PC) Version 2211). The version number is in the About Excel section further down the Account page.

    Cheers,

    Glenn.
    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.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  8. #8
    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,055

    Re: Formula to format source data correctly for Pivot table

    I have a vague idea that 16.72 is O365 for Mac...

    If so, try this. Delete ALL expected results.

    In any cell:

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


    No copy/paste or dragging required. Results spill across and down.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    04-20-2023
    Location
    berlin
    MS-Off Ver
    16.72
    Posts
    3

    Re: Formula to format source data correctly for Pivot table

    It worked!!!
    Thank you all, especially windknife and glen! Really appreciate it!

  10. #10
    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,055

    Re: Formula to format source data correctly for Pivot table

    You're welcome.

    But...

    Please update your profile, as requested.

  11. #11
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,005

    Re: Formula to format source data correctly for Pivot table

    You are welcome.

+ 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] Pivot Table new sheet to keep format as data source?
    By AccountingJ in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-30-2020, 01:37 PM
  2. [SOLVED] Pivot Table Creation maintaining source data format
    By egotrich in forum Excel General
    Replies: 1
    Last Post: 03-26-2018, 09:53 AM
  3. Formula to return Pivot Table data source
    By xtinct2 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-24-2016, 11:12 AM
  4. Replies: 0
    Last Post: 01-06-2016, 07:00 AM
  5. [SOLVED] Pivot table format changes if value of source data is null
    By Frustrated with formatting! in forum Excel General
    Replies: 1
    Last Post: 10-18-2013, 11:26 AM
  6. [SOLVED] Macro to update pivot item (date format) in pivot table to latest date from data source.
    By rocksan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-10-2012, 03:18 AM
  7. Pivot Table - Numbers won't format correctly in row
    By needexcelhelp23 in forum Excel General
    Replies: 4
    Last Post: 12-15-2009, 01:51 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