A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How can I test the text content of a cell



 
 
Thread Tools Display Modes
  #1  
Old March 17th, 2010, 12:43 AM posted to microsoft.public.excel.worksheet.functions
catefaulkes
external usenet poster
 
Posts: 1
Default How can I test the text content of a cell

I wish to create a logical test - an IF statement that tests whether a cell
contains H, M or L, and output the result as a number.
I cannot get the IF statement to recognise text as true or false - my Excel
2007 gives an error when I try to do something like IF(E9=H ....) is there a
way to do this?
  #2  
Old March 17th, 2010, 12:56 AM posted to microsoft.public.excel.worksheet.functions
Gord Dibben
external usenet poster
 
Posts: 20,252
Default How can I test the text content of a cell

=IF(E9="H"


Gord Dibben MS Excel MVP

On Tue, 16 Mar 2010 16:43:01 -0700, catefaulkes
wrote:

I wish to create a logical test - an IF statement that tests whether a cell
contains H, M or L, and output the result as a number.
I cannot get the IF statement to recognise text as true or false - my Excel
2007 gives an error when I try to do something like IF(E9=H ....) is there a
way to do this?


  #3  
Old March 17th, 2010, 12:56 AM posted to microsoft.public.excel.worksheet.functions
Fred Smith[_4_]
external usenet poster
 
Posts: 2,386
Default How can I test the text content of a cell

For Excel to recognize text, you need to surround it in quotes, like this:
=if(or(e9="H",e9="M",e9="L"),true,false)

Regards,
Fred

"catefaulkes" wrote in message
...
I wish to create a logical test - an IF statement that tests whether a cell
contains H, M or L, and output the result as a number.
I cannot get the IF statement to recognise text as true or false - my
Excel
2007 gives an error when I try to do something like IF(E9=H ....) is there
a
way to do this?


  #4  
Old March 17th, 2010, 01:08 AM posted to microsoft.public.excel.worksheet.functions
Mike H
external usenet poster
 
Posts: 8,419
Default How can I test the text content of a cell

Hi,

You don't say if you want a different number for each of the text values or
the same number so we'll start with the same number

=IF(OR(A1="H",A1="M",A1="L"),99999,"")


--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"catefaulkes" wrote:

I wish to create a logical test - an IF statement that tests whether a cell
contains H, M or L, and output the result as a number.
I cannot get the IF statement to recognise text as true or false - my Excel
2007 gives an error when I try to do something like IF(E9=H ....) is there a
way to do this?

  #5  
Old March 17th, 2010, 06:50 AM posted to microsoft.public.excel.worksheet.functions
macropod[_2_]
external usenet poster
 
Posts: 2,402
Default How can I test the text content of a cell

Hi catefaulkes,

Yet another approach:
=(E9="H")*1+(E9="M")*2+(E9="L")*3
Replace the 1,2,3 with whatever values you require. If no match occurs, 0 is returned.

--
Cheers
macropod
[Microsoft MVP - Word]


"catefaulkes" wrote in message ...
I wish to create a logical test - an IF statement that tests whether a cell
contains H, M or L, and output the result as a number.
I cannot get the IF statement to recognise text as true or false - my Excel
2007 gives an error when I try to do something like IF(E9=H ....) is there a
way to do this?

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:45 PM.


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