+ Reply to Thread
Results 1 to 8 of 8

Transpose data from one column based on criteria of a different column with VBA Arrays

  1. #1
    Registered User
    Join Date
    09-03-2018
    Location
    Leipzig, Germany
    MS-Off Ver
    Excel 2016
    Posts
    8

    Transpose data from one column based on criteria of a different column with VBA Arrays

    Hello,

    at first I have to say english isn't my first language. But I hope you will understand my problem.

    I have attached an example file.

    In this I want to tranpose some data from table "Contracts" to table "Overview" for easier filterability. Sadly a PivotTable solution was not viable, since it can't be really filtered the way I need to.

    Essentially we want to see which job order has multiple different reciept numbers. And transpose the company names behind the reciept to the table Overview. Max 10 company names. I did this manually in the example Overview.

    Not every job order has reciepts. What I didn't show in those table are that every job order has service description. This is for a cable company. So these reciepts are for services like digging a hole to access cables. But not every service has something billable - thats why there are empty cells.

    I thought about how to do this in VBA. The only solution I found is maybe load job order rows with the same job order in an array and with a for loop add reciept numbers that are not already contained in the array. And then simply outpout the company name belonging to the reciept per column in the table Overview.

    But I don't really know how to start or if there are better options for this kind of problem. Like I don't know how to load job order rows with the same job order number into an array.

    Some additional info:

    My original data contains over 200.000 rows.

    I am using excel 2016.

    This is my first time working with arrays, normally I can solve my problems with some for loops and if statements.

    I hope someone can help me jump start a solution. Thanks!
    Attached Files Attached Files
    Last edited by Anasurimbor; 09-03-2018 at 11:36 AM. Reason: grammar

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Transpose data from one column based on criteria of a different column with VBA Arrays

    See if this is how you wanted.
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    09-03-2018
    Location
    Leipzig, Germany
    MS-Off Ver
    Excel 2016
    Posts
    8

    Re: Transpose data from one column based on criteria of a different column with VBA Arrays

    Yes, that works perfectly. Thank you very much.

  4. #4
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Transpose data from one column based on criteria of a different column with VBA Arrays

    If you're using Windows then you could try something like this:

    Please Login or Register  to view this content.
    Edit: Ah, too late I see

    WBD

  5. #5
    Registered User
    Join Date
    09-03-2018
    Location
    Leipzig, Germany
    MS-Off Ver
    Excel 2016
    Posts
    8

    Re: Transpose data from one column based on criteria of a different column with VBA Arrays

    Quote Originally Posted by WideBoyDixon View Post
    If you're using Windows then you could try something like this:

    Please Login or Register  to view this content.
    Edit: Ah, too late I see

    WBD
    Both work. But I still have a problem.

    If I have a job order like in the attachments, where the company name is the same but the reciept number is different, it should output the company name two times (because of the two reciept numbers):
    200210751 | ANDRÄ Tief- & Hochbau GmbH | Kabelbau Leipzig GmbH | Kabelbau Leipzig GmbH
    Attached Files Attached Files

  6. #6
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Transpose data from one column based on criteria of a different column with VBA Arrays

    Small change then:

    Please Login or Register  to view this content.
    WBD

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Transpose data from one column based on criteria of a different column with VBA Arrays

    Try change to
    Please Login or Register  to view this content.
    Last edited by jindon; 09-03-2018 at 10:48 AM.

  8. #8
    Registered User
    Join Date
    09-03-2018
    Location
    Leipzig, Germany
    MS-Off Ver
    Excel 2016
    Posts
    8

    Re: Transpose data from one column based on criteria of a different column with VBA Arrays

    Quote Originally Posted by WideBoyDixon View Post
    Small change then:

    Please Login or Register  to view this content.
    WBD
    Now that makes sense. It works perfectly. Thanks again, you saved my ***.

+ 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. Rewrite VBA script from Column based arrays to Rows based arrays
    By wtell319 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-11-2018, 09:24 AM
  2. Transfer data based on value in Column using arrays
    By salmasaied in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 10-07-2016, 02:15 AM
  3. multiple look up arrays to sum column based on various criteria
    By deanusa in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-14-2016, 04:11 AM
  4. Replies: 11
    Last Post: 02-16-2016, 11:06 PM
  5. [SOLVED] Copy data from column to other sheets, based upon vlookup/criteria on column a
    By jedemeyer1 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 03-27-2013, 04:01 AM
  6. Excel Transpose Column to Rows Based on Criteria
    By lilianphoebs in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-22-2011, 02:57 PM
  7. Excel Transpose Column to Rows Based on Criteria
    By lilianphoebs in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-14-2011, 10:49 AM

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