+ Reply to Thread
Results 1 to 12 of 12

If and statement for multiple criteria

Hybrid View

  1. #1
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    If and statement for multiple criteria

    Hi All

    Need a formula for the following statement please:

    If C75="YES" and K14>0 then value = 60
    Else
    If C75 = "YES" and K14>0 and L14>0 then value = 120
    Else
    If C75 = "YES" and K14>0 and L14>0 and M14>0 then value = 150
    Else value = 0

    Thank you in advance for your help.

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,800

    Re: If and statement for multiple criteria

    Try

    =IF(AND(C75="yes",K14>0),60,IF(AND(C75="yes",K14>0,L14>0),120,IF(AND(C75="yes",K14>0,L14>0,M14>0),150,0)))

  3. #3
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: If and statement for multiple criteria

    Let me give a detailed explanation.

    I have three columns K14,L14 AND M14 which can be populated with either 0 or 1 or 2.
    Lets pretend C75 is always YES.

    If any one of the columns > 0 then 60

    If any two of the columns > 0 then 120

    If all 3 columns > 0 the 150

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,800

    Re: If and statement for multiple criteria

    or

    =IF(C75="yes",IF(COUNT(K14:M14)=1,60,IF(COUNT(K14:M14)=2,120,IF(COUNT(K14:M14)=3,150,0))),0)

    The original I posted should have been

    =IF(AND(C75="yes",K14>0,L14>0,M14>0),150,IF(AND(C75="yes",K14>0,L14>0),120,IF(AND(C75="yes",K14>0),60,0)))

    Basic error on order of criteria (by me!)

    See Beamernsw for neat solution.
    Last edited by JohnTopley; 01-04-2016 at 10:41 AM.

  5. #5
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: If and statement for multiple criteria

    Hi John

    Thanks for input. Strange enough, I tried that and it always returns the value of 60.

    I'm lost

  6. #6
    Valued Forum Contributor
    Join Date
    12-28-2014
    Location
    NSW, Australia
    MS-Off Ver
    MS365
    Posts
    606

    Re: If and statement for multiple criteria

    Try this one:
    =IF(C75="YES",IF(AND(K14>0,L14>0,M14>0),150,IF(AND(K14>0,L14>0),120,IF(K14>0,60,0))),0)

    Edit:- Sorry I didn't see your last post and therefore have the criteria the same as your 1st post.
    Last edited by Beamernsw; 01-04-2016 at 10:25 AM.

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,800

    Re: If and statement for multiple criteria

    try

    =IF(AND(C75="yes",COUNT(K14:M14)=1),60,IF(AND(C75="yes",COUNT(K14:M14)=2),120,IF(AND(C75="yes",COUNT(K14:M14)=3),150,0)))

  8. #8
    Valued Forum Contributor
    Join Date
    12-28-2014
    Location
    NSW, Australia
    MS-Off Ver
    MS365
    Posts
    606

    Re: If and statement for multiple criteria

    Also:
    =IF(C75="YES",MIN(COUNT(K14:M14)*60,150),0)

  9. #9
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: If and statement for multiple criteria

    Hi Guys

    Both work as long as The columns are blank or 1 or 2.
    However, if 0 is inserted then it doesn't work

  10. #10
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: If and statement for multiple criteria

    Not to worry.

    I have used data validation in columns which forces 1 or 2...Problem solved.
    Thank you John & Beamernsw

  11. #11
    Valued Forum Contributor
    Join Date
    12-28-2014
    Location
    NSW, Australia
    MS-Off Ver
    MS365
    Posts
    606

    Re: If and statement for multiple criteria

    ahh, you are absolutely right....sorry about that.
    I'm glad you have it fixed, but incase you did want the correct formula:-

    =IF(C75="YES",MIN(COUNTIF(K14:M14,">"&0)*60,150),0)
    Edit:- BTW, that formula leaves 0 in the cell if C75 is NOT "YES". If you would rather the cell be blank:-
    =IF(C75="YES",MIN(COUNTIF(K14:M14,">"&0)*60,150),"")
    Last edited by Beamernsw; 01-04-2016 at 11:46 AM.

  12. #12
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: If and statement for multiple criteria

    Awesome thanks
    Beamernsw

+ 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] If Statement with Multiple Criteria
    By jdoerr1021 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-21-2015, 11:04 AM
  2. [SOLVED] countifs statement with multiple criteria for multiple criteria ranges
    By mcdermott2 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 05-07-2015, 11:48 AM
  3. Count statement wtih multiple criteria only showing results for one criteria
    By uhlabomber in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-17-2013, 02:47 PM
  4. [SOLVED] If statement that will look among multiple criteria and generate a statement
    By liz5818 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-01-2013, 04:12 PM
  5. [SOLVED] Multiple Criteria within an If Statement.
    By UsmanBPD in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-24-2012, 12:52 PM
  6. If statement with multiple criteria
    By Savitri in forum Excel General
    Replies: 2
    Last Post: 06-06-2010, 11:25 PM
  7. If Statement with multiple criteria
    By Ada01 in forum Excel General
    Replies: 4
    Last Post: 11-19-2009, 10:26 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