+ Reply to Thread
Results 1 to 6 of 6

Using IF statement with multiple values.

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    01-27-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    120

    Using IF statement with multiple values.

    Hi,

    I am trying to write an IF statement to do the following:

    If cell A1 contains 17, then display a 1, else display a blank.

    Cell A1 contains the following 4, 6, 9, 17, 21, 45.
    Is it possible to pick up 17 out of a cell when there is other data contained within that cell.

    Cheers

    Terry

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,156

    Re: Using IF statement with multiple values.

    hi Terry, welcome to the forum. if data is always consistent with 1 space & comma, then:
    =IF(ISNUMBER(FIND("17, ",A1&" ")),1,"")

    otherwise, upload an Excel sample of the many variations you have
    Last edited by benishiryo; 01-27-2013 at 10:27 PM. Reason: spotted mistake after seeing Tony's formula

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Forum Contributor
    Join Date
    01-27-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    120

    Re: Using IF statement with multiple values.

    Bang on, Thank you very much. I hope to visit Singapore again soon, cracking place.

    Once again, thank you.

    best regards

    Terry

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Using IF statement with multiple values.

    Try this...

    =IF(COUNT(FIND(" 17,"," "&A1&",")),1,"")
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Forum Contributor
    Join Date
    01-27-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    120

    Re: Using IF statement with multiple values.

    Quote Originally Posted by Tony Valko View Post
    Try this...

    =IF(COUNT(FIND(" 17,"," "&A1&",")),1,"")
    Works a treat. Many thanks Tony and thank you for the prompt response.

    Terry

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Using IF statement with multiple values.

    You're welcome. 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)

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