+ Reply to Thread
Results 1 to 9 of 9

Excel 2007 : Transposing Values w/ Duplicate Fields (Vertically Arranged) Horizontally

  1. #1
    Registered User
    Join Date
    05-17-2012
    Location
    Manila
    MS-Off Ver
    Excel 2007
    Posts
    6

    Transposing Values w/ Duplicate Fields (Vertically Arranged) Horizontally

    Hi!

    I have here an file extracted from a database that is arranged vertically (Column A is the Fields, Column B is the values). Now from the vertically arranged values, they can be divided into one set. On the file attached, each set's start point is tagged as "F" in column A and the end point is tagged as "E' in column B.

    What I want to happen is to transpose all values from vertical to horizontal, but values should already be consolidated according to fields (since the fields in Column A are duplicate fields already, but the values counterpart in Column B are different). No need to transpose all items in Column A, just the 352 common fields.

    To better understand, I've attached the file of reference and the output that should come out.

    Hope you can help me out on this. Still figuring if I can do this in Access, but hopefully Excel should be enough
    Attached Files Attached Files

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Transposing Values w/ Duplicate Fields (Vertically Arranged) Horizontally

    I tried a code for you but apparently, each section is not 352 rows right? I found some sections (From F to E) having only 340 rows.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    05-17-2012
    Location
    Manila
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Transposing Values w/ Duplicate Fields (Vertically Arranged) Horizontally

    I just noticed that discrepancy as well. But I think the bottom line result that I want here is that all values for "F" should be aligned into one column, all the values for "E" should be aligned in one column, etc... I was thinking of something similar to a VLOOKUP but instead of getting the top value, you retrieve all the values.

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Transposing Values w/ Duplicate Fields (Vertically Arranged) Horizontally

    A vlookup will not help you.

    The macro was working out, but its creating an issue since the number of rows is not consistent. Will check again on how i can restructure the code.

  5. #5
    Registered User
    Join Date
    05-17-2012
    Location
    Manila
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Transposing Values w/ Duplicate Fields (Vertically Arranged) Horizontally

    Quote Originally Posted by arlu1201 View Post
    A vlookup will not help you.

    The macro was working out, but its creating an issue since the number of rows is not consistent. Will check again on how i can restructure the code.
    Any luck? I am starting to realize that a lookup won't help. No possible formula or option where you can lookup a whole range of values

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Transposing Values w/ Duplicate Fields (Vertically Arranged) Horizontally

    Try this code
    Please Login or Register  to view this content.
    Copy the Excel VBA code
    Select the workbook in which you want to store the Excel VBA code
    Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
    Choose Insert | Module
    Where the cursor is flashing, choose Edit | Paste

    To run the Excel VBA code:
    Choose View | Macros
    Select a macro in the list, and click the Run button.

  7. #7
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Transposing Values w/ Duplicate Fields (Vertically Arranged) Horizontally

    Try using the code as the attached file. I have copied the code to a blank file (macro file). Copy the headings you require into sheet 2 column A of the macro file. The output will appear in Sheet 1 of the macro file.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    05-17-2012
    Location
    Manila
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Transposing Values w/ Duplicate Fields (Vertically Arranged) Horizontally

    Quote Originally Posted by arlu1201 View Post
    Try using the code as the attached file. I have copied the code to a blank file (macro file). Copy the headings you require into sheet 2 column A of the macro file. The output will appear in Sheet 1 of the macro file.
    Hey, sorry it took a while for me to respond. I tried the code you gave and it worked out great! Thanks for your help there. Problem is, the disparity of the number rows affected the file that's why some of the fields there were misplaced, usually it's a row higher. I'll try my luck to find a way to iron this out, maybe through MS Access.
    Attached Files Attached Files

  9. #9
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Transposing Values w/ Duplicate Fields (Vertically Arranged) Horizontally

    Ok. If this question has been solved, please mark it so. Select Thread Tools (on top of your 1st post) -> Mark this thread as Solved.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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