+ Reply to Thread
Results 1 to 6 of 6

Getting The MAX value of Column Only Of Those Rows Holding A Certain Value

  1. #1
    Forum Contributor
    Join Date
    06-15-2009
    Location
    Ontario, canada
    MS-Off Ver
    Office 365
    Posts
    371

    Getting The MAX value of Column Only Of Those Rows Holding A Certain Value

    What is an efficient VBA solution to doing this?

    I have a worksheet with values in row A, B and C.
    Variable recordic = 31286

    This value can be found anywhere from once to hundreds in column A.
    Column B holds numbers.

    I need code that will find the largest value from column B (max) for the values in A that equal recordid.

    In other words, if I were to filter column A for the value of recordid, I would need to find the largest number in column B of the filtered data. If I filter the data, and apply max to column B of the filtered data, I don't get the right answer.

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Getting The MAX value of Column Only Of Those Rows Holding A Certain Value

    I would suggest using an extra (helper) column maybe next to column B,
    The header a field where you enter the Id you want to check and in the rows below a formula that shows the value in B when the ID is = to the ID in the header and then show the MAX value of this number.
    You have not mentioned it but I am assuming you're working on a MAC (version 2019 does not exist for Windows)
    Attach a sample file even if on a Windows system most things work seamlessly with a MAC
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: Getting The MAX value of Column Only Of Those Rows Holding A Certain Value

    Attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  4. #4
    Forum Contributor
    Join Date
    06-15-2009
    Location
    Ontario, canada
    MS-Off Ver
    Office 365
    Posts
    371

    Re: Getting The MAX value of Column Only Of Those Rows Holding A Certain Value

    Thank you Hans for your sharing your approach.
    I actually played around and found this solution. It might be a bit slow with vast amounts of data, but it seems to be doing the trick.
    Please Login or Register  to view this content.
    And no, not a MAC unfortunately. Perhaps Office 2019 is also known as Office 365?
    Last edited by Jenn68; 05-11-2019 at 07:44 AM.

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

    Re: Getting The MAX value of Column Only Of Those Rows Holding A Certain Value

    Variable "rn" should be declared as Variant.
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    06-15-2009
    Location
    Ontario, canada
    MS-Off Ver
    Office 365
    Posts
    371

    Re: Getting The MAX value of Column Only Of Those Rows Holding A Certain Value

    Thank you jindon. That cleaned things up a bait.

+ 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] Calculating Holding Period Return in a Column
    By bradleytunger in forum Excel General
    Replies: 6
    Last Post: 09-06-2017, 04:16 PM
  2. [SOLVED] Holding the value of a formula in DIM??
    By locopete999 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-01-2016, 06:47 AM
  3. Holding Values
    By jlowe in forum Excel General
    Replies: 5
    Last Post: 03-16-2012, 02:13 PM
  4. Holding values
    By fpalmay in forum Excel General
    Replies: 3
    Last Post: 11-26-2009, 07:35 PM
  5. P&L via Holding Signals
    By sajeel in forum Excel General
    Replies: 3
    Last Post: 10-13-2009, 01:54 AM
  6. Vlookup not holding
    By ibabs in forum Excel General
    Replies: 5
    Last Post: 07-29-2009, 05:37 PM
  7. [SOLVED] holding a value after first calcuation
    By spence in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-26-2006, 08:00 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