+ Reply to Thread
Results 1 to 4 of 4

If function with range and two criteria

  1. #1
    Registered User
    Join Date
    08-03-2007
    Posts
    19

    If function with range and two criteria

    I have the following formula below to return "C" if the value in the cell is "C", and nothing if not.

    I want to expand it to return "C" if the value in the cell is "C" or "D", for a range between C2:H2.


    =IF(C2="C","C","")

    I'm have trouble with this easy adjustment.
    Last edited by moding blaine; 04-15-2009 at 02:15 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: If function with range and two criteria

    This formula returns "C" if a "C" is found and a "D" if a "D" is found... it posts whichever it finds first, if both letters exist in the range:

    =IF(COUNTIF(C2:H2,"C"),"C",IF(COUNTIF(C2:H2,"D"),"D",""))

    is that what you needed?
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    08-03-2007
    Posts
    19

    Re: If function with range and two criteria

    Thanks for your help!

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: If function with range and two criteria

    You are welcome... actually, just a correction in my statement:
    it posts whichever it finds first, if both letters exist in the range:
    That is not true; it will post a "C" if a "C" exists, whether it is before or after any "D" in the range... it will only post a "D" if that is the only letter matching... (i.e. no "C" in the range at all)....

    Just wanted to clarify that in case you expected the results I had described.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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