+ Reply to Thread
Results 1 to 7 of 7

Max if formula incorporating OR function

  1. #1
    Registered User
    Join Date
    01-21-2022
    Location
    UK
    MS-Off Ver
    O365
    Posts
    5

    Max if formula incorporating OR function

    Hi

    I'm trying to write a formula which will bring back the maximum date if a number of multiple conditions are met, but including an OR function.

    =MAX(IF(AllInspections!$A$2:$A$2000=LatestFullInspection!$B2,IF(OR(AllInspections!$D$2:$D$2000=Sheet1!$C$2,AllInspections!$D$2:$D$2000=Sheet1!$C$3,AllInspections!$D$2:$D$2000=Sheet1!$C$4,AllInspections!$D$2:$D$2000=Sheet1!$C$5),AllInspections!$C$2:$C$2000)))

    The first $B2 match is working but the match in the OR function is not, it is bringing back the max date overall and not taking into account the OR criteria

    Any ideas?

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,448

    Re: Max if formula incorporating OR function

    Welcome to the forum.

    There are instructions at the top of the page explaining how to attach your sample workbook.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. It also has expected results mocked up, relevant cells highlighted and a few explanatory notes.

    You could use this perhaps:

    =MAX(MAXIFS(one_set_of_criteria),MAXIFS(the_other_set_of_criteria))
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    01-21-2022
    Location
    UK
    MS-Off Ver
    O365
    Posts
    5

    Re: Max if formula incorporating OR function

    Thanks - I've attached a workbook with some sample data, the formulas in, highlighting the actual results vs the expected results.
    Attached Files Attached Files

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Max if formula incorporating OR function

    One way:

    =AGGREGATE(14,6,$B$3:$B$21/(($A$3:$A$21=F3)*($C$3:$C$21={"Full Inspection","Standard Inspection"})),1)
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  5. #5
    Registered User
    Join Date
    01-21-2022
    Location
    UK
    MS-Off Ver
    O365
    Posts
    5

    Re: Max if formula incorporating OR function

    Fab - that seems to work......any chance you could explain what it is doing?

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Max if formula incorporating OR function

    Yes, sure..

    =AGGREGATE(14,6,$B$3:$B$21/(($A$3:$A$21=F3)*($C$3:$C$21={"Full Inspection","Standard Inspection"})),1)

    red. When A3:A13= value in F3
    green. And
    orange. C3-21 is either FI or SI
    Blue return the largest value (14 = large, 15 = small)
    Black from this range


    You're welcome.



    It would be very nice if you were to just click the Add Reputation button at the foot of any of the posts of members who helped you reach a solution.

    Finally, if that takes care of your original question, please select "Thread Tools" from the menu link (just above the first post in the thread) and mark this thread as SOLVED.

  7. #7
    Registered User
    Join Date
    01-21-2022
    Location
    UK
    MS-Off Ver
    O365
    Posts
    5

    Re: Max if formula incorporating OR function

    Thank you - that will be really useful - so if I substituted the 14 for 15 it would bring back the earliest date?

    What does the 6 do?

    Also assume I could add in additional criteria?

+ 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] Incorporating the Trim function into a formula
    By Ron Purpura in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-08-2017, 03:54 AM
  2. Incorporating an IF function with my Index/Match formula?
    By VBAhelp3456 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-04-2015, 03:57 AM
  3. [SOLVED] incorporating a cell value in an IF Function
    By Charters in forum Excel General
    Replies: 5
    Last Post: 06-20-2014, 01:11 AM
  4. Incorporating the results of a MAX function in to an OFFSET Function
    By tennisbuff in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-17-2013, 01:10 PM
  5. total while Incorporating IF function Formula - Revisited
    By mbnewton1 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-22-2013, 03:39 PM
  6. Subtotal while Incorporating IF function Formula
    By mbnewton1 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-21-2013, 10:57 PM
  7. [SOLVED] Incorporating a CountIF function into VBA
    By jbumps in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-14-2012, 06:21 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