ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Wildcards in IF statement (https://www.excelbanter.com/excel-discussion-misc-queries/231974-wildcards-if-statement.html)

Ant

Wildcards in IF statement
 
I'm trying to use a IF statement to determine if a text of 4 characters
second digit is a 2 to say "Happy" else "Sad". Ex. if "0204" then "Happy",
"Sad".

I can't get the wildcard characters to work.
--
Thank you,
Ant

Jacob Skaria

Wildcards in IF statement
 
=IF(MID(F23,2,1)="2","Happy","Sad")
--
If this post helps click Yes
---------------
Jacob Skaria


"Ant" wrote:

I'm trying to use a IF statement to determine if a text of 4 characters
second digit is a 2 to say "Happy" else "Sad". Ex. if "0204" then "Happy",
"Sad".

I can't get the wildcard characters to work.
--
Thank you,
Ant


Mike H

Wildcards in IF statement
 
Try

=IF(MID(A1,2,1)="2","Happy","Sad")

Mike

"Ant" wrote:

I'm trying to use a IF statement to determine if a text of 4 characters
second digit is a 2 to say "Happy" else "Sad". Ex. if "0204" then "Happy",
"Sad".

I can't get the wildcard characters to work.
--
Thank you,
Ant


Ant

Wildcards in IF statement
 
Yes this works. Thanks.
--
Thank you,
Ant


"Mike H" wrote:

Try

=IF(MID(A1,2,1)="2","Happy","Sad")

Mike

"Ant" wrote:

I'm trying to use a IF statement to determine if a text of 4 characters
second digit is a 2 to say "Happy" else "Sad". Ex. if "0204" then "Happy",
"Sad".

I can't get the wildcard characters to work.
--
Thank you,
Ant


Ant

Wildcards in IF statement
 
This works and I think it would work better than me using =LEFT and OR
statements.
--
Thank you,
Ant


"Jacob Skaria" wrote:

=IF(MID(F23,2,1)="2","Happy","Sad")
--
If this post helps click Yes
---------------
Jacob Skaria


"Ant" wrote:

I'm trying to use a IF statement to determine if a text of 4 characters
second digit is a 2 to say "Happy" else "Sad". Ex. if "0204" then "Happy",
"Sad".

I can't get the wildcard characters to work.
--
Thank you,
Ant


RagDyeR

Wildcards in IF statement
 
You could use Left() if you wished, and return the same results:

=IF(LEFT(RIGHT(A1,3))="2","Happy","Sad")
--
Regards,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------

"Ant" wrote in message
...
This works and I think it would work better than me using =LEFT and OR
statements.
--
Thank you,
Ant


"Jacob Skaria" wrote:

=IF(MID(F23,2,1)="2","Happy","Sad")
--
If this post helps click Yes
---------------
Jacob Skaria


"Ant" wrote:

I'm trying to use a IF statement to determine if a text of 4 characters
second digit is a 2 to say "Happy" else "Sad". Ex. if "0204" then
"Happy",
"Sad".

I can't get the wildcard characters to work.
--
Thank you,
Ant





All times are GMT +1. The time now is 08:48 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com