+ Reply to Thread
Results 1 to 3 of 3

vba to get the minimum and maximum values based on a unique ID

  1. #1
    Registered User
    Join Date
    11-27-2011
    Location
    Bucharest, Romania
    MS-Off Ver
    Excel 2003
    Posts
    9

    vba to get the minimum and maximum values based on a unique ID

    Hi I’m trying to use VBA to get the minimum and maximum values of two columns based of an ID.
    I have three columns (A, B, C) with headers containing numeric digits.
    So far I managed to make the macro to list the unique ID and count how many times this ID is repeated.
    I need to get maximum and minimum values of the first two columns based on the third column (ID).
    Any ideas would be greatly appreciated!
    Input Sheet
    Value 1 Value 2 ID
    100 500 3
    100 700 3
    101 800 4
    90 1000 1
    800 900 8
    1000 397 50
    70 50 1
    120 900 3
    80 70 8
    342 322 1
    356 368 4
    370 215 4
    384 161 1
    398 107 1
    411 54 8
    425 0 3
    439 -54 8

    Results sheet:
    ID Counts Min Value1 Max Value1 Min Value2 Max Value2
    1 5 70 398 50 1000
    3 4 100 425 0 900
    4 3 101 370 215 800
    8 4 80 800 -54 900
    50 1 1000 1000 397 397
    Attached Files Attached Files

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: vba to get the minimum and maximum values based on a unique ID

    Here's how I would do all that:
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    11-27-2011
    Location
    Bucharest, Romania
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: vba to get the minimum and maximum values based on a unique ID

    Thank you!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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