+ Reply to Thread
Results 1 to 5 of 5

getting max value using vba based on multiple criteria

  1. #1
    Registered User
    Join Date
    11-23-2020
    Location
    ktm
    MS-Off Ver
    2007
    Posts
    9

    getting max value using vba based on multiple criteria

    Hello, need help with the attached excel file. I need a script to run and look for maximum values under Discount% of a particular Customer but only under Category 'a' and 'b'. The result should then be displayed under Result Column on row of category 'a'...Thanx in advance.....
    Attached Files Attached Files

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: getting max value using vba based on multiple criteria

    Format column E as percentage and try this macro:
    Please Login or Register  to view this content.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

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

    Re: getting max value using vba based on multiple criteria

    E2:

    =IF(COUNTIF(A$2:A2,A2)=1,MAX(IF(($A$2:$A$10=A2)*(($C$2:$C$10="a")+($C$2:$C$10="b")),$D$2:$D$10)),"")

    confirm with Ctrl + Shift + Enter (array formula entry) and copy down.


    VBA
    Please Login or Register  to view this content.
    Last edited by jindon; 04-22-2021 at 11:48 PM.

  4. #4
    Registered User
    Join Date
    11-23-2020
    Location
    ktm
    MS-Off Ver
    2007
    Posts
    9

    Re: getting max value using vba based on multiple criteria

    I tried to incorporate it into my workbook but did not work. Sorry, I misrepresented my actual worksheet in sample file. So, uploading the sample file again with desired result.
    Attached Files Attached Files
    Last edited by ratm698; 04-25-2021 at 12:46 PM.

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

    Re: getting max value using vba based on multiple criteria

    Please Login or Register  to view this content.

+ 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. Replies: 2
    Last Post: 12-27-2020, 04:10 AM
  2. [SOLVED] Values based on multiple criteria including grouped criteria
    By adsako in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 03-21-2020, 01:24 PM
  3. Replies: 4
    Last Post: 09-02-2019, 04:14 PM
  4. [SOLVED] Merge multiple sheets data into 1 sheet based on multiple criteria (List Based)
    By hecgroups in forum Excel Programming / VBA / Macros
    Replies: 43
    Last Post: 08-10-2018, 11:08 AM
  5. [SOLVED] Sum based on multiple criteria using sumproduct: One criteria is 'cell contains'.....
    By jeroenv in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-04-2018, 08:18 AM
  6. [SOLVED] How to sum values based on multiple criteria with multple possibilities for each criteria?
    By boredaxel in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-05-2013, 02:26 AM
  7. MACROS: Sort by multiple criteria - Create tabs based off of criteria
    By svineyard in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-21-2009, 10:48 AM

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