+ Reply to Thread
Results 1 to 3 of 3

If statement 'formula' not working

  1. #1
    Bricktop
    Guest

    If statement 'formula' not working

    I have two if statements that I need to combine into one statement. The
    first statement I have is:
    =IF(S1>DATEVALUE("10/20/2005"),1,IF(S1=DATEVALUE("10/20/2005"),3,2))
    the second statement I have is:
    =IF(SEARCH("pen",S3),2,1)
    The second statement is where I am having trouble. I tried to add this to
    the first statement like so:
    =IF(S1>DATEVALUE("10/20/2005"),1,IF(S1=DATEVALUE("10/20/2005"),3,IF(SEARCH("pending",S3),2,2)))

    But the second statement is coming back as a 1. I am new to these if
    statements so any help is greatly appreciated.
    Thanks.

  2. #2
    Alok
    Guest

    RE: If statement 'formula' not working

    Hi,

    Search returns the position of the match.
    For instance =Search("pen","pending") will return a value of 1 but
    =Search("pen","spending") will return true.
    If you want to say that pen should be found somewhere in S3 then you have to
    say =if (Search("pen",S3)>0,<true part>,<false part>)

    Hope this helps you to find the bug.

    Alok


    "Bricktop" wrote:

    > I have two if statements that I need to combine into one statement. The
    > first statement I have is:
    > =IF(S1>DATEVALUE("10/20/2005"),1,IF(S1=DATEVALUE("10/20/2005"),3,2))
    > the second statement I have is:
    > =IF(SEARCH("pen",S3),2,1)
    > The second statement is where I am having trouble. I tried to add this to
    > the first statement like so:
    > =IF(S1>DATEVALUE("10/20/2005"),1,IF(S1=DATEVALUE("10/20/2005"),3,IF(SEARCH("pending",S3),2,2)))
    >
    > But the second statement is coming back as a 1. I am new to these if
    > statements so any help is greatly appreciated.
    > Thanks.


  3. #3
    JNW
    Guest

    RE: If statement 'formula' not working

    This would be a great question for the folks in the 'Excel
    WorksheetFunctions' forum as this one is for programming questions.

    "Bricktop" wrote:

    > I have two if statements that I need to combine into one statement. The
    > first statement I have is:
    > =IF(S1>DATEVALUE("10/20/2005"),1,IF(S1=DATEVALUE("10/20/2005"),3,2))
    > the second statement I have is:
    > =IF(SEARCH("pen",S3),2,1)
    > The second statement is where I am having trouble. I tried to add this to
    > the first statement like so:
    > =IF(S1>DATEVALUE("10/20/2005"),1,IF(S1=DATEVALUE("10/20/2005"),3,IF(SEARCH("pending",S3),2,2)))
    >
    > But the second statement is coming back as a 1. I am new to these if
    > statements so any help is greatly appreciated.
    > Thanks.


+ 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