+ Reply to Thread
Results 1 to 15 of 15

compress rows same ID

  1. #1
    Registered User
    Join Date
    03-10-2021
    Location
    Manchester
    MS-Off Ver
    Microsoft 365
    Posts
    13

    Post compress rows same ID

    Hi Excel gurus,

    I have a task I'm stuck on and need help please.

    I have multiple rows with the same data up to a point i.e. columns A:J then the data changes from K:Q. if K:M has data then N:P will be empty and visa versa. So I'm looking for a way to compress the data into one row.

    The ID will be the identifier and there are possibly thousands of rows of data each time.

    If there are more than 2 records for credit no's then only one credit number record needs to be shown, doesn't matter which on so could be the earlier or latest. This is the same with the receipts. I have shown this in the attachment.

    Hope the image is more clearer than my explanation.

    Thanks
    Attached Images Attached Images
    Last edited by Ummy2021; 04-30-2024 at 10:32 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2407 (Windows 11 23H2 64-bit)
    Posts
    83,150

    Re: compress rows same ID

    There are instructions at the top of the page explaining how to attach your sample workbook (yellow banner: HOW TO ATTACH YOUR SAMPLE WORKBOOK). Screenshots are of little practical use as we cannot manipulate them.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. The sample layout accurately matches that of your real data. It also has expected results mocked up, worked examples where required, relevant cells highlighted and a few explanatory notes.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,522

    Re: compress rows same ID

    Is there always only 2 entries per unique id...If not, then I suggest you upload a sample file with more than 2 showing expected result of this data merge...
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  4. #4
    Registered User
    Join Date
    03-10-2021
    Location
    Manchester
    MS-Off Ver
    Microsoft 365
    Posts
    13

    Re: compress rows same ID

    Hi, If there are more than 2 records for credit no's then only one credit number record needs to be shown, doesn't matter which on so could be the earlier or latest. This is the same with the receipts. I have now shown this in the attachment.

  5. #5
    Forum Expert
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,512

    Re: compress rows same ID

    Perhab like this
    Please Login or Register  to view this content.
    Last edited by daboho; 04-30-2024 at 10:33 AM.
    "Presh Star Who has help you *For Add Reputation!! And mark case as Solve"

  6. #6
    Registered User
    Join Date
    03-10-2021
    Location
    Manchester
    MS-Off Ver
    Microsoft 365
    Posts
    13

    Re: compress rows same ID

    thank you for the prompt reply, the code is falling over though.

    It errors on the below line.

    ReDim Preserve v(1 To n)

  7. #7
    Forum Expert
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,512

    Re: compress rows same ID

    I am sorri i has update code should be dim v() or v() copy update code
    Last edited by daboho; 04-30-2024 at 09:59 AM.

  8. #8
    Registered User
    Join Date
    03-10-2021
    Location
    Manchester
    MS-Off Ver
    Microsoft 365
    Posts
    13

    Re: compress rows same ID

    sorry, just seen you message.
    Last edited by Ummy2021; 04-30-2024 at 10:03 AM.

  9. #9
    Registered User
    Join Date
    03-10-2021
    Location
    Manchester
    MS-Off Ver
    Microsoft 365
    Posts
    13

    Re: compress rows same ID

    That is amazing, thats exactly what I needed.

    Thank you.

  10. #10
    Forum Expert
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,512

    Re: compress rows same ID

    Or using collection
    Please Login or Register  to view this content.
    Last edited by daboho; 04-30-2024 at 03:22 PM.

  11. #11
    Registered User
    Join Date
    03-10-2021
    Location
    Manchester
    MS-Off Ver
    Microsoft 365
    Posts
    13

    Re: compress rows same ID

    what does it mean by collections? thanks

  12. #12
    Forum Expert
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,512

    Re: compress rows same ID

    Same as with dictionary but
    Any different little
    Dictionaty easy for update and collection hard to update
    Collection is more easy to write and read more than dictionary

  13. #13
    Registered User
    Join Date
    03-10-2021
    Location
    Manchester
    MS-Off Ver
    Microsoft 365
    Posts
    13

    Re: compress rows same ID

    ah, thanks

  14. #14
    Forum Expert
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,512

    Re: compress rows same ID

    Dont forget mak case as solved

  15. #15
    Registered User
    Join Date
    03-10-2021
    Location
    Manchester
    MS-Off Ver
    Microsoft 365
    Posts
    13

    Re: compress rows same ID

    thanks, ive changed the prefix to SOLVED, i think thats all i need to do.

+ 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] Macro that will compress the 3 rows into one
    By IonutC in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-27-2016, 02:27 PM
  2. Replies: 6
    Last Post: 12-14-2015, 02:22 PM
  3. Compress Coding
    By priceisright in forum Excel General
    Replies: 4
    Last Post: 06-20-2011, 12:16 PM
  4. Replies: 2
    Last Post: 04-02-2009, 05:56 AM
  5. Deleting Rows to compress data
    By Leal72 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-11-2007, 04:11 PM
  6. [SOLVED] Compress file
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-21-2006, 09:10 AM
  7. [SOLVED] Compress file
    By [email protected] in forum Excel General
    Replies: 0
    Last Post: 04-19-2006, 04:30 PM

Tags for this Thread

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