+ Reply to Thread
Results 1 to 7 of 7

Convert rows to columns problem

  1. #1
    Registered User
    Join Date
    12-27-2014
    Location
    rome
    MS-Off Ver
    office plus 2013
    Posts
    6

    Convert rows to columns problem

    Hello to everyone, i'm news here. I come from Italy, Rome, and i'm sorry if i could make mistake with your language.

    I start expalining my problem. As you can guess from the title, it concerns the convertation of rows/columns to columns/rows.

    excel problem.jpg

    As you can see from the image, i have a full list of countries with theirs respective indicators of agriculture, industry and services (in percentage of GDP).

    Now, i tried almost everything (and of course the special paste button) but it results almost impossible to create a new table with every percentage situated in 3 columns : agriculture, industry and services. I attach on image to make it easier to understand.

    problem.jpg

    Any help will be grateful.

    edit : i attached the xlsx file, if anyone want to help me.
    Attached Files Attached Files
    Last edited by saveu90; 12-27-2014 at 05:37 PM.

  2. #2
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 365
    Posts
    2,406

    Re: Convert rows to columns problem

    Dont' put image, more useful attach your small sample workbook, and that could be attract the solver see your post, click "Go Advanced" and find paperclip button to attach your file.

    cheeers

  3. #3
    Registered User
    Join Date
    12-27-2014
    Location
    rome
    MS-Off Ver
    office plus 2013
    Posts
    6

    Re: Convert rows to columns problem

    I attached the whole xlsx file, thank you.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,050

    Re: Convert rows to columns problem

    Add a couble of extra columns after column B (3 should be enough)
    Highlight all the data in column B
    Select Data Tab/Text2Column/Delimited/next/Other/use : as the delimiter

    This should give you a seperated list of "type" and %

    Now in 1 of those helper columns (I used E), copy this all the way down...
    =IF(A3="",E2,A3)

    Then in your table, use this, copied down and adcross...
    =INDEX($D$3:$D$931,MATCH($G3&H$2,INDEX($E$3:$E$931&$C$3:$C$931,0)))

    (This assumes your counties startin G3 and your "type" starts in H3

    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    1
    COUNTRY
    GDP - COMPOSITION, BY SECTOR OF ORIGIN(%)
    2
    COUNTRY
    AGRICULTURE
    INDUSTRY
    SERVICES
    3
    Afghanistan agriculture:*20%* agriculture *20%* Afghanistan Afghanistan
    *20%*
    *25.6%*
    *54.4%*
    4
    industry:*25.6%* industry *25.6%* Afghanistan Albania
    *19.5%*
    *12%*
    0%
    5
    services:*54.4%* services *54.4%* Afghanistan Algeria
    6
    note:*data exclude opium production (2011 est.) note *data exclude opium production (2011 est.) Afghanistan American Samoa
    7
    Afghanistan Andorra
    20%
    25.6%
    54.40%
    8
    Albania agriculture:*19.5%* agriculture *19.5%* Albania Angola
    19.50%
    12%
    68.50%
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,943

    Re: Convert rows to columns problem

    See the attached file
    Attached Files Attached Files
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  6. #6
    Registered User
    Join Date
    12-27-2014
    Location
    rome
    MS-Off Ver
    office plus 2013
    Posts
    6

    Re: Convert rows to columns problem

    Thank you both!! I'm so much grateful!

    Just one question, could you expalin me the: =INDEX($D$3:$D$931,MATCH($G3&H$2,INDEX($E$3:$E$931&$C$3:$C$931,0))) function? So that next time i can solve my problem myself, without bothering other people?

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,050

    Re: Convert rows to columns problem

    =INDEX($D$3:$D$931,MATCH($G3&H$2,INDEX($E$3:$E$931&$C$3:$C$931,0)))

    INDEX() returns the entry at the intesection ofr a given row number and column number...
    =INDEX(A2:J10,2,4)
    would give the contents at the intesection of row 3 (2 rows from A2 - A1 is the 1st row) and column D
    or in your example...
    =INDEX($D$3:$D$931,row???)
    If the index range is only 1 column, then you can leave out teh last INDEX argument

    So all we need to do is ID which row to use. For that, we use MATCH
    MATCH is normally used on a single column (or row) of data...
    =MATCH(criteria,range,0) the 0 is for an exact match
    =MATCH($G3,$E$3:$E$931,0)

    In your case, we need to match 2 criteria with 2columns of data, so I combined the criteria with &, and I brought in a 2nd INDEX() to combine the 2 criteria columns (so that using ARRAY was avoided)
    =MATCH($G3&H$2,INDEX($E$3:$E$931&$C$3:$C$931,0))
    That gives the row to plug into the INDEX...
    =INDEX($D$3:$D$931,MATCH($G3&H$2,INDEX($E$3:$E$931&$C$3:$C$931,0)))

+ 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] Convert rows to columns
    By Geno in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-23-2020, 03:17 PM
  2. Replies: 1
    Last Post: 11-29-2012, 06:24 PM
  3. Convert Rows to Columns
    By shreya in forum Excel General
    Replies: 1
    Last Post: 06-24-2010, 08:31 AM
  4. [SOLVED] to convert columns to rows having mulit independent group columns
    By Quacy in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-22-2006, 06:25 PM
  5. [SOLVED] Can I convert columns to rows?
    By Adam@Penda in forum Excel General
    Replies: 3
    Last Post: 01-11-2005, 04:06 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