+ Reply to Thread
Results 1 to 12 of 12

Converting columns into rows

  1. #1
    Registered User
    Join Date
    07-14-2013
    Location
    nd
    MS-Off Ver
    Excel 2003
    Posts
    6

    Converting columns into rows

    Hi All,
    i would need a help in excel to convert the data from columns into rows as mentioned below

    \current excel data is
    dept emp1 sal emp2 sal2 emp3 sal3
    HR Abc 123 bcv 231 sjn 987
    IT sddds 9876 ds 999 dsb 123

    Expected data
    Dept emp sal
    HR Abc 123
    bcv 231
    sjn 987
    IT sdds 9876
    ds 999
    dsb 123

    There are close to 10000 records like this is there any formula/function to chnage this data. Requesting help on this.

  2. #2
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Converting columns into rows

    How many Employees can any Department have?

    Does the attached workbook look like your data and expected result?

    It is always better to attach a sample workbook.Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    Attached Files Attached Files
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  3. #3
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Converting columns into rows

    codesearcher,

    Welcome to the Excel Forum.

    What is the worksheet name that contains the following information?

    \current excel data is
    dept emp1 sal emp2 sal2 emp3 sal3
    HR Abc 123 bcv 231 sjn 987
    IT sddds 9876 ds 999 dsb 123
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  4. #4
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Converting columns into rows

    codesearcher,

    I assume that your beginning raw data is in the first worksheet (the left most worksheet in the tabs view).

    I can also edit the macro code for the correct raw data worksheet name.


    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

    1. Copy the below code, by highlighting the code and pressing the keys CTRL + C
    2. Open your workbook
    3. Press the keys ALT + F11 to open the Visual Basic Editor
    4. Press the keys ALT + I to activate the Insert menu
    5. Press M to insert a Standard Module
    6. Where the cursor is flashing, paste the code by pressing the keys CTRL + V
    7. Press the keys ALT + Q to exit the Editor, and return to Excel
    8. To run the macro from Excel, open the workbook, and press ALT + F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.

    Please Login or Register  to view this content.
    Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm

    Then run the ReorgData macro.

  5. #5
    Registered User
    Join Date
    07-14-2013
    Location
    nd
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Converting columns into rows

    Yes the attachment is what I wanted. There can be any number of employees within a department.
    Thanks. we will attach enough details going forward.

  6. #6
    Registered User
    Join Date
    07-14-2013
    Location
    nd
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Converting columns into rows

    Thanks that is working as expected. What needs to be done to the macro if I have the varying number of employees within a department?

  7. #7
    Registered User
    Join Date
    07-14-2013
    Location
    nd
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Converting columns into rows

    Yea!! This macro is working as expected for varying columns also. I have an additional requirement, to sum up the salary as attached.
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Converting columns into rows

    codesearcher,

    When you respond to someone that is helping you, please use there name/handle, so that we can follow what is going on.

    This way the correct helper can respond.

  9. #9
    Registered User
    Join Date
    07-14-2013
    Location
    nd
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Converting columns into rows

    yes sure Stanley. The earlier post was reply to Mr.Stanley reply.

  10. #10
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Converting columns into rows

    codesearcher,

    I still assume that your beginning raw data is in the first worksheet (the left most worksheet in the tabs view).


    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

    Please Login or Register  to view this content.
    Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm

    Then run the ReorgDataV2 macro.

  11. #11
    Registered User
    Join Date
    07-14-2013
    Location
    nd
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Converting columns into rows

    Thanks a lot Mr.Stanley!! it works perfect.

  12. #12
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Converting columns into rows

    codesearcher,

    You are very welcome. Glad I could help.

    Thanks for the feedback.

    And, come back anytime.

+ 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. Converting multiple columns to rows / Converting to Panel Data
    By Stuart11 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-14-2013, 05:50 AM
  2. Converting columns into rows
    By Max Wallace in forum Excel General
    Replies: 5
    Last Post: 03-23-2013, 07:32 PM
  3. Converting columns to rows for multiple rows
    By khscruz in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-04-2011, 11:59 AM
  4. Converting rows to columns
    By RTownley in forum Excel General
    Replies: 10
    Last Post: 06-09-2010, 01:34 AM
  5. [SOLVED] Converting Columns to Rows
    By Chris D'Onofrio in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-30-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