+ Reply to Thread
Results 1 to 6 of 6

If statement multiple conditions and criteria

  1. #1
    Registered User
    Join Date
    10-24-2010
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    32

    If statement multiple conditions and criteria

    Hi all,

    Forgive me for the code I have put below but I have typed it out on my iPad as I do not have access to my laptop s the syntax and the full code isn't there but on my actual spreadsheet it's correct.

    Please Login or Register  to view this content.
    So as you can see it's the if statement with multiple criteria that wasn't working ..

    It kept just going to the final else statement where the msgbox said criteria not met.

    So the if statement checks a cell on a sheet that has the value one and then check the last record of the other sheet, the value in column c and if it is has the value GHS. IF it meets them both it will do the following action.

    I can't see what I am missing.

    Maybe it's something silly but I'll try post the proper code tomorrow morning (15 hours from now) if it's something more complicated.

    Thank you

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: If statement multiple conditions and criteria

    the only thing wrong here is
    range("b & lastrowMaster")
    the second quote mark is in the wrong place. should be right after b. I tested the statement with the quote mark in the correct position and it worked OK.

  3. #3
    Registered User
    Join Date
    10-24-2010
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: If statement multiple conditions and criteria

    If instr(1, sheets("sheet2").range("a3"), "1") > 0 And instr(1, sheets("sheet1").range("b" & lastrowMaster).offset(0, 2).value, "GHS") > 0

    The criteria "GHS" i've noticed that it does not meet the criteria if it is in normal text but if its in CAPS then it matches. How can I make it so if the text GHS in any form is met?

  4. #4
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: If statement multiple conditions and criteria

    Hi there,

    Try:

    Please Login or Register  to view this content.
    Hope this helps - please let me know how you get on.

    Regards,

    Greg M

  5. #5
    Registered User
    Join Date
    10-24-2010
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: If statement multiple conditions and criteria

    Quote Originally Posted by Greg M View Post
    Hi there,

    Try:

    Please Login or Register  to view this content.
    Hope this helps - please let me know how you get on.

    Regards,

    Greg M
    Thank you!!!

  6. #6
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: If statement multiple conditions and criteria

    Hi again,

    You're welcome - glad I was able to help.

    Regards,

    Greg M

+ 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. IF Statement with Multiple Conditions and Multiple True/False Results
    By ellesutgr in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-03-2015, 04:51 PM
  2. Replies: 2
    Last Post: 07-09-2015, 04:25 PM
  3. multiple conditions IF statement
    By aschom in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-07-2013, 08:14 AM
  4. Multiple conditions in an 'IF' statement
    By dlburkins in forum Excel General
    Replies: 3
    Last Post: 04-25-2011, 04:21 PM
  5. IF statement w/multiple conditions
    By JimS in forum Excel General
    Replies: 1
    Last Post: 04-14-2008, 09:32 AM
  6. IF Statement with multiple conditions
    By Ladypep in forum Excel General
    Replies: 3
    Last Post: 04-05-2006, 09:50 AM
  7. [SOLVED] If statement using multiple conditions
    By SCOOBYDOO in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-06-2005, 12:05 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