+ Reply to Thread
Results 1 to 13 of 13

Need to rearrange items in row so all columns have the same data

  1. #1
    Forum Contributor
    Join Date
    04-27-2009
    Location
    Dallas, TX
    MS-Off Ver
    Office 365
    Posts
    215

    Need to rearrange items in row so all columns have the same data

    I get this list of invoices and part of the list shows these Tracking ID Charge Descriptions (Fuel Surcharge, Saturday Delivery, Customs Duty, etc) and Tracking ID Charge amounts. Each invoice may have multiple charge descriptions. The problem is that instead of having a column header with the name of the charge and then the value of that charge on the invoice line, it puts the name of the charge on the same line in one column, then next to it it'll have the amount, then the next column will have another charge and the next column will have the amount. To complicate matters even further these rows don't have the charge descriptions line up in the same column. So there is no way for me to do any kind of vlookup or anything like that. I'm really not sure what the best way to go about organizing this data is.
    Attached Files Attached Files
    Last edited by mvparker79; 07-10-2014 at 05:48 PM.

  2. #2
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Need to rearrange items in row so all columns have the same data

    oh man... that's nuts!

    What is this data coming from exactly? This could be fixed with VBA, but it shouldn't have to be. Does this come from a Sql database or somthing?
    Remember, saying thanks only takes a second or two. Click the star icon(*) below the post you liked, to give some Rep if you think an answer deserves it.

    Please,mark your thread [SOLVED] if you received your answer.

  3. #3
    Forum Contributor
    Join Date
    04-27-2009
    Location
    Dallas, TX
    MS-Off Ver
    Office 365
    Posts
    215

    Re: Need to rearrange items in row so all columns have the same data

    It is sent to us via FedEx. Stupid I know.

  4. #4
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Need to rearrange items in row so all columns have the same data

    Well, you could put it all into one table (attached is an example of that) and then maybe pivot from that table if you need a summary.

    Have a look at the attached workbook. The code to make the simple table is below

    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    04-27-2009
    Location
    Dallas, TX
    MS-Off Ver
    Office 365
    Posts
    215

    Re: Need to rearrange items in row so all columns have the same data

    This is great! What part do I need to change so that it offsets to the appropriate column in my actual file. The one I sent you had a lot of data removed.

  6. #6
    Forum Contributor
    Join Date
    04-27-2009
    Location
    Dallas, TX
    MS-Off Ver
    Office 365
    Posts
    215

    Re: Need to rearrange items in row so all columns have the same data

    Never mind. I figured it out! Thanks!!

  7. #7
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Need to rearrange items in row so all columns have the same data

    No problem, glad it worked out.

  8. #8
    Forum Contributor
    Join Date
    04-27-2009
    Location
    Dallas, TX
    MS-Off Ver
    Office 365
    Posts
    215

    Re: Need to rearrange items in row so all columns have the same data

    One last thing. I've moved a few things around and I'm wanting to add to the output tab the invoice date. I've gotten everything to work except for the fact that the value that it is bringing in is not in date format. Here is the section of the code where I'm getting my 'Type mismatch' error.

    Please Login or Register  to view this content.
    I've also tried:

    Please Login or Register  to view this content.

  9. #9
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Need to rearrange items in row so all columns have the same data

    post up an example please.

  10. #10
    Forum Contributor
    Join Date
    04-27-2009
    Location
    Dallas, TX
    MS-Off Ver
    Office 365
    Posts
    215

    Re: Need to rearrange items in row so all columns have the same data

    I've changed up the code a bit to work with my original file before I edited it before sending. Right now, I'm just trying to work with the invoice date piece. What I would ultimately like to have in the Reorganized Data tab is the month of the invoice date so that the pivot table can be summarized by month.

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    04-27-2009
    Location
    Dallas, TX
    MS-Off Ver
    Office 365
    Posts
    215

    Re: Need to rearrange items in row so all columns have the same data

    Here is the new file I'm working with.
    Attached Files Attached Files

  12. #12
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Need to rearrange items in row so all columns have the same data

    Got it to work. The CDate() was the right idea, but you need to make a string to pass into that function (see below).

    I used MID(), RIGHT(), and LEFT() to put this in the MM/DD/YYYY format (e.g., 4/25/2014). When you do that, the CDate() works properly.

    Please Login or Register  to view this content.

  13. #13
    Forum Contributor
    Join Date
    04-27-2009
    Location
    Dallas, TX
    MS-Off Ver
    Office 365
    Posts
    215

    Re: Need to rearrange items in row so all columns have the same data

    Ha! That's nearly exactly what I've been working on while waiting. lol I decided that I'd like to have the first day of that month. I've been able to get the code to display the month name, however when I do the pivot the dates aren't sorted chronologically. So I've been trying to get the EOMonth function to work with this line:

    Please Login or Register  to view this content.
    But I get the following error:

    "Unable to get the EoMonth property of the WorksheetFunction class"

    Whatever that means...

+ 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. Copy data from worksheet into another, rearrange columns.
    By adelkam in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-03-2013, 10:11 PM
  2. [SOLVED] How can I rearrange data in several columns?
    By amisdar in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-28-2012, 10:20 PM
  3. Macro to rearrange data from 1 column to 3 new columns???
    By papaj79 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-28-2012, 08:49 AM
  4. Rearrange data from 6 columns to 1 column
    By narzio in forum Excel General
    Replies: 3
    Last Post: 03-06-2012, 02:43 AM
  5. Rearrange two columns of data
    By RexAtHighSpeed in forum Excel General
    Replies: 1
    Last Post: 12-20-2005, 04:30 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