+ Reply to Thread
Results 1 to 13 of 13

Keep or store rows for each non-repeated name

  1. #1
    Forum Contributor
    Join Date
    11-24-2016
    Location
    Libya
    MS-Off Ver
    Office 365
    Posts
    526

    Keep or store rows for each non-repeated name

    Hello excel experts

    In the first worksheet, there are values from range("A2:F" & lr) where lr is the last row based on column A. In column D, there are names (the names are repeated). I need to build a dictionary for the unique names (column D) which will be keyed. Each key should store a 2d array of the rows related to that key.

    I found that code but I got errors on this line [ReDim Preserve rows(LBound(rows) To UBound(rows) + 1, 1 To 6)]
    Please Login or Register  to view this content.
    Last edited by KingTamo; 03-11-2023 at 05:47 AM.

  2. #2
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: Keep or store rows for each non-repeated name

    sample file and expected output?
    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!!!

  3. #3
    Forum Contributor
    Join Date
    11-24-2016
    Location
    Libya
    MS-Off Ver
    Office 365
    Posts
    526

    Re: Keep or store rows for each non-repeated name

    No specific output. I just want to build a dictionary with the unique keys from column D. and later we can loop through the keys and retrieve the stored rows.

  4. #4
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: Keep or store rows for each non-repeated name

    From experience you should well know that previously, code has been supplied, and YOU are not able to adapt it to fit your actual file...
    Hence, so as not to waste time, upload a sample file and explain what it is you are wanting to achieve...

  5. #5
    Forum Contributor
    Join Date
    11-24-2016
    Location
    Libya
    MS-Off Ver
    Office 365
    Posts
    526

    Re: Keep or store rows for each non-repeated name

    The code is well but there is a problem with the ReDim Preserve statement. No specific output sir sintek. just wanted to store the related rows to each unique key.

  6. #6
    Forum Contributor
    Join Date
    11-24-2016
    Location
    Libya
    MS-Off Ver
    Office 365
    Posts
    526

    Re: Keep or store rows for each non-repeated name

    Sample of information:

    col a --- col b --- col c --- col d --- col e --- col f
    **************************************
    aa --- bb --- cc --- ITEM1 --- ee --- ff
    aaa --- bbb --- ccc --- ITEM2 --- eee --- fff
    a1 --- b1 --- c1 --- ITEM1 --- e1 --- f1

    The desired output
    ***************
    ITEM1
    aa --- bb --- cc --- ITEM1 --- ee --- ff
    a1 --- b1 --- c1 --- ITEM1 --- e1 --- f1

    ITEM2
    aaa --- bbb --- ccc --- ITEM2 --- eee --- fff

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

    Re: Keep or store rows for each non-repeated name

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    11-24-2016
    Location
    Libya
    MS-Off Ver
    Office 365
    Posts
    526

    Re: Keep or store rows for each non-repeated name

    Thanks a lot sir jindon. Is it probable to modify the first code that uses a dictionary?

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

    Re: Keep or store rows for each non-repeated name

    that code doesn't make sense to me
    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    11-24-2016
    Location
    Libya
    MS-Off Ver
    Office 365
    Posts
    526

    Re: Keep or store rows for each non-repeated name

    Amazing code sir Jindon.

  11. #11
    Forum Contributor
    Join Date
    11-24-2016
    Location
    Libya
    MS-Off Ver
    Office 365
    Posts
    526

    Re: Keep or store rows for each non-repeated name

    I noticed each block of results consists of the name as a key and the related rows. That's great.
    How can I add another row (the headers) to be the second component
    I mean the key is the first element. The header row is the second element. The third element is the related rows.

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

    Re: Keep or store rows for each non-repeated name

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

  13. #13
    Forum Contributor
    Join Date
    11-24-2016
    Location
    Libya
    MS-Off Ver
    Office 365
    Posts
    526

    Re: Keep or store rows for each non-repeated name

    Excellent. Thank you so much.

+ 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. Help! sum repeated rows
    By SHAYJOSH in forum Excel General
    Replies: 4
    Last Post: 07-22-2018, 04:44 PM
  2. Rows to be repeated at the bottom
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-07-2015, 04:48 PM
  3. [SOLVED] Moving data from Rows to columns and delete repeated rows
    By mikearmanios in forum Excel General
    Replies: 5
    Last Post: 04-20-2014, 06:25 AM
  4. Macro to store results of repeated calculation
    By universal-E in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-26-2012, 10:16 AM
  5. Remove repeated rows.
    By Hugo555 in forum Excel General
    Replies: 1
    Last Post: 05-07-2009, 03:09 AM
  6. sum once for repeated rows
    By Jasonic in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 04-11-2009, 12:53 PM
  7. Deleting repeated rows
    By anjanesh in forum Excel General
    Replies: 3
    Last Post: 06-03-2006, 12:55 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