+ Reply to Thread
Results 1 to 4 of 4

How To Nest Multiple IF and OR statements...

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    02-09-2016
    Location
    West Midlands
    MS-Off Ver
    2016
    Posts
    224

    How To Nest Multiple IF and OR statements...

    Hi,

    I have the following If condition;

    If Range("G1") <> "In-play" And Range("K3") = "Placed BACK Bet" And Range("AH10") = Range("AE4") Then
    I also have many others with slight variations, such as;

    If Range("G1") <> "In-play" And Range("K3") = "Placed BACK Bet" And Range("AH12") = Range("AE4") Then

    Because the First Two conditions are always the same but the Third is different can i use the first part as IF and then add multiple OR conditions to the last part?

    ie;

    If Range("G1") <> "In-play" And Range("K3") = "Placed BACK Bet" And Range("AH10") = Range("AE4") Or Range("AH12") = Range("AE4") Then
    Will this work or do i have to add 'And Or' when testing the 'Or' conditions within the 'If' conditions? Such as;

    If Range("G1") <> "In-play" And Range("K3") = "Placed BACK Bet" And Range("AH10") = Range("AE4") And Or Range("AH12") = Range("AE4") Then
    Many Thanks for your time guys!

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: How To Nest Multiple IF and OR statements...

    You can use brackets
    If Range("G1") <> "In-play" And Range("K3") = "Placed BACK Bet" And (Range("AH10") = Range("AE4") Or Range("AH12") = Range("AE4")) Then
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: How To Nest Multiple IF and OR statements...

    If Range("G1") <> "In-play" And Range("K3") = "Placed BACK Bet" And (Range("AH10") = Range("AE4") Or Range("AH12") = Range("AE4")) Then
    assuming you want to so the same thing in each instance

  4. #4
    Forum Contributor
    Join Date
    02-09-2016
    Location
    West Midlands
    MS-Off Ver
    2016
    Posts
    224

    Re: How To Nest Multiple IF and OR statements...

    Works Perfectly Thanks Guys! (Rep Left!)

+ 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] How to nest INDEX and Match into IF statements?
    By neojihui in forum Excel General
    Replies: 5
    Last Post: 08-20-2015, 05:10 AM
  2. Nest If Statements Dependent on Multiple Cells
    By shanafesta in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-22-2015, 12:12 AM
  3. [SOLVED] Can I nest Countifs Statements in an IF / OR statement?
    By CWatsonJr in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 10-02-2013, 04:13 PM
  4. [SOLVED] Can I nest IF statements, if the first one is checking for data?
    By Barnaclebot in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-15-2013, 03:25 PM
  5. [SOLVED] How to nest two IF statements
    By wolfgang713 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 01-15-2013, 09:50 AM
  6. Nest Lookup With If And Statements
    By opeyemi1 in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 02-19-2008, 11:57 AM
  7. How do I nest IF statements to only return value if both true?
    By kvnexcel in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-14-2006, 01:40 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