Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 87
Default If formula with text string help please

In column C ..... I would like to ask the question....if A2=1 and B2 which
is formatted as "general" has a year date in its string which is 2003 the
answer = "vaccine given" but if the year date is <2003 then the answer
="vaccine due". Also I should add if A2 is 0 then the answer =na.

I'm not sure how to proceed and any help would be appreciated.

A B C
1 HIST-Pnuemo-10/01/2007 vaccine given
0 HIST-Pnuemo-07/24/2009 na
1 HIST-Pnuemo-01/01/2003 vaccine due

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 915
Default If formula with text string help please

ferde wrote:
In column C ..... I would like to ask the question....if A2=1 and B2 which
is formatted as "general" has a year date in its string which is 2003 the
answer = "vaccine given" but if the year date is <2003 then the answer
="vaccine due". Also I should add if A2 is 0 then the answer =na.

I'm not sure how to proceed and any help would be appreciated.

A B C
1 HIST-Pnuemo-10/01/2007 vaccine given
0 HIST-Pnuemo-07/24/2009 na
1 HIST-Pnuemo-01/01/2003 vaccine due


If you can assume B /always/ has a 4-digit year on the right this should
work in C1. Fill down as needed:

=IF(A1=1,IF(VALUE(RIGHT(TRIM(B1),4))2003,"vaccine given","vaccine
due"),"na")

Allowance has been made for trailing spaces in B.
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 87
Default If formula with text string help please

Thank you works like a charm

"smartin" wrote:

ferde wrote:
In column C ..... I would like to ask the question....if A2=1 and B2 which
is formatted as "general" has a year date in its string which is 2003 the
answer = "vaccine given" but if the year date is <2003 then the answer
="vaccine due". Also I should add if A2 is 0 then the answer =na.

I'm not sure how to proceed and any help would be appreciated.

A B C
1 HIST-Pnuemo-10/01/2007 vaccine given
0 HIST-Pnuemo-07/24/2009 na
1 HIST-Pnuemo-01/01/2003 vaccine due


If you can assume B /always/ has a 4-digit year on the right this should
work in C1. Fill down as needed:

=IF(A1=1,IF(VALUE(RIGHT(TRIM(B1),4))2003,"vaccine given","vaccine
due"),"na")

Allowance has been made for trailing spaces in B.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 87
Default If formula with text string help please

The formula you gave me works great but I forgot to consider that B2 may
be empty and so now I get a value error using the formula you suggested
because there is no date to calculate...is there an easy fix for this ?

So if A2 =1 and B2 is empty ...then C 2 = Vaccine due

Thank you again for your help

"ferde" wrote:

In column C ..... I would like to ask the question....if A2=1 and B2 which
is formatted as "general" has a year date in its string which is 2003 the
answer = "vaccine given" but if the year date is <2003 then the answer
="vaccine due". Also I should add if A2 is 0 then the answer =na.

I'm not sure how to proceed and any help would be appreciated.

A B C
1 HIST-Pnuemo-10/01/2007 vaccine given
0 HIST-Pnuemo-07/24/2009 na
1 HIST-Pnuemo-01/01/2003 vaccine due

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 915
Default If formula with text string help please

Was this directed at me?

Try this in C2 (not C1 as before):

=IF((A2=1)*(B2<""),IF(VALUE(RIGHT(TRIM(B2),4))20 03,"vaccine
given","vaccine due"),"na")


ferde wrote:
The formula you gave me works great but I forgot to consider that B2 may
be empty and so now I get a value error using the formula you suggested
because there is no date to calculate...is there an easy fix for this ?

So if A2 =1 and B2 is empty ...then C 2 = Vaccine due

Thank you again for your help

"ferde" wrote:

In column C ..... I would like to ask the question....if A2=1 and B2 which
is formatted as "general" has a year date in its string which is 2003 the
answer = "vaccine given" but if the year date is <2003 then the answer
="vaccine due". Also I should add if A2 is 0 then the answer =na.

I'm not sure how to proceed and any help would be appreciated.

A B C
1 HIST-Pnuemo-10/01/2007 vaccine given
0 HIST-Pnuemo-07/24/2009 na
1 HIST-Pnuemo-01/01/2003 vaccine due



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 87
Default If formula with text string help please

Smartin... I plugged in the new formula into C2 but it gives me "na" as a
result but it should read "vaccine due" because the value in A2=1

am I doing something wrong?



"smartin" wrote:

Was this directed at me?

Try this in C2 (not C1 as before):

=IF((A2=1)*(B2<""),IF(VALUE(RIGHT(TRIM(B2),4))20 03,"vaccine
given","vaccine due"),"na")


ferde wrote:
The formula you gave me works great but I forgot to consider that B2 may
be empty and so now I get a value error using the formula you suggested
because there is no date to calculate...is there an easy fix for this ?

So if A2 =1 and B2 is empty ...then C 2 = Vaccine due

Thank you again for your help

"ferde" wrote:

In column C ..... I would like to ask the question....if A2=1 and B2 which
is formatted as "general" has a year date in its string which is 2003 the
answer = "vaccine given" but if the year date is <2003 then the answer
="vaccine due". Also I should add if A2 is 0 then the answer =na.

I'm not sure how to proceed and any help would be appreciated.

A B C
1 HIST-Pnuemo-10/01/2007 vaccine given
0 HIST-Pnuemo-07/24/2009 na
1 HIST-Pnuemo-01/01/2003 vaccine due


  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 915
Default If formula with text string help please

Sorry about that. Try this instead in A2 and fill down:

=IF(A2=0,"na",IF((A2=1)*(IF(ISERROR(VALUE(RIGHT(B2 ,4))),0,VALUE(RIGHT(B2,4)))2003),"vaccine
given","vaccine due"))

Result 1:

1 HIST-Pnuemo-10/01/2007 vaccine given
0 HIST-Pnuemo-07/24/2009 na
1 HIST-Pnuemo-01/01/2003 vaccine due

Result 2:

1 <blank vaccine due
0 HIST-Pnuemo-07/24/2009 na
1 HIST-Pnuemo-01/01/2003 vaccine due


ferde wrote:
Smartin... I plugged in the new formula into C2 but it gives me "na" as a
result but it should read "vaccine due" because the value in A2=1

am I doing something wrong?



"smartin" wrote:

Was this directed at me?

Try this in C2 (not C1 as before):

=IF((A2=1)*(B2<""),IF(VALUE(RIGHT(TRIM(B2),4))20 03,"vaccine
given","vaccine due"),"na")


ferde wrote:
The formula you gave me works great but I forgot to consider that B2 may
be empty and so now I get a value error using the formula you suggested
because there is no date to calculate...is there an easy fix for this ?

So if A2 =1 and B2 is empty ...then C 2 = Vaccine due

Thank you again for your help

"ferde" wrote:

In column C ..... I would like to ask the question....if A2=1 and B2 which
is formatted as "general" has a year date in its string which is 2003 the
answer = "vaccine given" but if the year date is <2003 then the answer
="vaccine due". Also I should add if A2 is 0 then the answer =na.

I'm not sure how to proceed and any help would be appreciated.

A B C
1 HIST-Pnuemo-10/01/2007 vaccine given
0 HIST-Pnuemo-07/24/2009 na
1 HIST-Pnuemo-01/01/2003 vaccine due

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
Using Text string in Sum formula JadeTiger Excel Discussion (Misc queries) 2 May 8th 09 06:57 AM
Nested formula to search a text string and return specific text Barbie Excel Worksheet Functions 10 February 21st 09 07:40 AM
Text String Formula Q Seanie Excel Worksheet Functions 4 October 23rd 08 09:47 AM
Formula Text String: Formatting Text and Numbers? dj479794 Excel Discussion (Misc queries) 5 June 30th 07 12:19 AM
formula with text string redb Excel Discussion (Misc queries) 1 September 29th 05 10:51 AM


All times are GMT +1. The time now is 09:35 PM.

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"