Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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(S1DATEVALUE("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(S1DATEVALUE("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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 318
Default 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(S1DATEVALUE("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(S1DATEVALUE("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   Report Post  
Posted to microsoft.public.excel.programming
JNW JNW is offline
external usenet poster
 
Posts: 480
Default 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(S1DATEVALUE("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(S1DATEVALUE("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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
IF Statement not working steve12173 Excel Worksheet Functions 7 June 18th 09 06:44 PM
IF Statement not working Barrett M Excel Worksheet Functions 8 May 6th 08 03:29 PM
If statement working only once Lime Excel Worksheet Functions 0 May 5th 08 03:58 AM
If Statement Not Working Telegirl Excel Worksheet Functions 9 May 12th 07 04:34 PM
If statement not working right TimT Excel Programming 2 July 11th 05 06:18 PM


All times are GMT +1. The time now is 03:54 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"