+ Reply to Thread
Results 1 to 4 of 4

How can I do If then elseif in Formula

Hybrid View

  1. #1
    Registered User
    Join Date
    06-20-2013
    Location
    Los Angeles
    MS-Off Ver
    Excel 2010
    Posts
    29

    How can I do If then elseif in Formula

    I am trying to come up with a formula that will check if values in the range A2:A25 contains either Yes or No or Both (Yes and No) and then in A1 display

    No if range only contains cells with No
    Yes if range only contains cells with Yes
    Both if the cells contain both No and Yes

    Can someone please help me with the formula, I know how to check if it range contains a "yes" or a "no" but am not sure how to check for the condition when some cells have Yes and some Cells have No. Some of the cells might be blank in the range as well.

    Thanks

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: How can I do If then elseif in Formula

    Try this.

    Formula: copy to clipboard
    =IF(AND(COUNTIF(A2:A25,"NO"),COUNTIF(A2:A25,"YES")=0),"NO",IF(AND(COUNTIF(A2:A25,"YES"),COUNTIF(A2:A25,"NO")=0),"YES","BOTH"))
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Registered User
    Join Date
    06-20-2013
    Location
    Los Angeles
    MS-Off Ver
    Excel 2010
    Posts
    29

    Re: How can I do If then elseif in Formula

    Fotis. Thank you so much for such a quick reply. It is perfect and it works !!

  4. #4
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: How can I do If then elseif in Formula

    You are welcome and thanks for the feedback.

+ 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. Code stepping in to elseif statement when elseif is definitely not true
    By DFrank231 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-13-2013, 05:31 PM
  2. If Elseif elseif problem
    By tjbillund in forum Excel General
    Replies: 3
    Last Post: 08-10-2011, 07:02 AM
  3. elseif formula
    By macrodummy in forum Excel General
    Replies: 1
    Last Post: 10-07-2005, 09:05 AM
  4. [SOLVED] Re: IF..Then..ELSE.. ELSEIF
    By rjamison in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-13-2005, 08:05 PM
  5. IF..Then..ELSE.. ELSEIF
    By ole_ in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-20-2005, 11:06 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