+ Reply to Thread
Results 1 to 8 of 8

Loop through groups of unique identifiers and perform counting actions on other columns

  1. #1
    Registered User
    Join Date
    09-03-2012
    Location
    Online
    MS-Off Ver
    Excel 2016
    Posts
    48

    Loop through groups of unique identifiers and perform counting actions on other columns

    Hi,

    I'm attempting to come up with a script that loops through groups of unique identifiers in Column A and performs some actions based on the contents of other columns (I can probably work out my own code for much of it, just not identifying the groups).

    For example, sample data:

    Column A Unique ID Column B
    00001 0
    00001 0
    00001 0
    00001 1
    00002 0
    00002 3
    00002 3
    00002 1
    00002 0
    00002 2
    00002 1
    00003 3
    00003 3
    00003 1

    How could I loop through these so that I find the highest number in column B for each of the unique identifiers? Probably best if the answer is delivered to another sheet so the unique identifiers are not reproduced. From this starting point I hope I can flesh out the rest of my queries like spitting other things in to more columns etc (low, average, counts, etc).

    Column A Identifier Column B Highest Number
    00001 1
    00002 3
    00002 3
    Attached Files Attached Files
    Last edited by anakaine; 09-06-2016 at 09:01 PM.

  2. #2
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,794

    Re: Loop through groups of unique identifiers and perform counting actions on other column

    Based on your uploaded file you could perhaps use an array formula like

    Please Login or Register  to view this content.
    array formula has to to be entered pressing Ctrl + Shift + Enter after you typed the formula.

    Alf

  3. #3
    Registered User
    Join Date
    09-03-2012
    Location
    Online
    MS-Off Ver
    Excel 2016
    Posts
    48

    Re: Loop through groups of unique identifiers and perform counting actions on other column

    Thanks Alf

    I'll give it a go.
    I was hoping for some VBA so I could work some other logic functions in to the code as well and extend as I went.

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

    Re: Loop through groups of unique identifiers and perform counting actions on other column

    VBA
    Please Login or Register  to view this content.

  5. #5
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Loop through groups of unique identifiers and perform counting actions on other column

    Can try SQL way too:
    Please Login or Register  to view this content.
    多么想要告诉你 我好喜欢你

  6. #6
    Registered User
    Join Date
    09-03-2012
    Location
    Online
    MS-Off Ver
    Excel 2016
    Posts
    48

    Re: Loop through groups of unique identifiers and perform counting actions on other column

    Jindon, Mills,

    Both of those are seriously awesome. Thank you very much!

  7. #7
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,621

    Re: Loop through groups of unique identifiers and perform counting actions on other column

    Small correction on Jindon's code when Sheet1 is Activesheet when executing code.
    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  8. #8
    Registered User
    Join Date
    09-03-2012
    Location
    Online
    MS-Off Ver
    Excel 2016
    Posts
    48

    Re: Loop through groups of unique identifiers and perform counting actions on other column

    Thanks bakerman2

+ 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. Find data based off unique identifiers and return only columns showing data
    By yomamma34 in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 12-23-2014, 05:03 PM
  2. [SOLVED] If statement needs to perform (2) two actions
    By eptownie1988 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-11-2014, 12:41 PM
  3. How to shift an array of data into columns based on unique identifiers...
    By PolishJoke in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-11-2014, 06:05 PM
  4. Replies: 7
    Last Post: 06-27-2014, 02:26 AM
  5. Running a loop with multiple Unique identifiers from OE DB connection
    By pmothers in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-24-2012, 06:05 PM
  6. Perform various actions before exiting
    By Flaguette in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-14-2007, 07:20 AM
  7. How to perform two actions ?
    By morph000 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-21-2006, 10:20 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