A Microsoft Excel forum. ExcelBanter

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 » ExcelBanter forum » Excel Newsgroups » Excel Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

nested "If statement" using text



 
 
Thread Tools Display Modes
  #1  
Old February 15th 07, 04:58 PM posted to microsoft.public.excel.worksheet.functions
RonB
external usenet poster
 
Posts: 15
Default nested "If statement" using text

This is my expression.

=IF(M1="M",12,IF(M1="SM",24,IF(M1="W",24.2,IF(M1=" BW",26.07,IF(M1="A",1)))))

The result is "False" for the "M","A", and "w". The results for "SM" and
"BW" are correct. (24 and 26.07) is there something wrong with my statement?

Thanks

Ron B
Ads
  #2  
Old February 15th 07, 05:04 PM posted to microsoft.public.excel.worksheet.functions
joel
external usenet poster
 
Posts: 9,101
Default nested "If statement" using text

The code works exactly as written.
If I enter the following letters in M1 I get
M 12
SM 24
W 24
BW 26.07

any other input get FALSE because M1="A",1 there is no 2nd parameter

you could write M1="A",1,0

then you would get a 0 for any other response

"RonB" wrote:

> This is my expression.
>
> =IF(M1="M",12,IF(M1="SM",24,IF(M1="W",24.2,IF(M1=" BW",26.07,IF(M1="A",1)))))
>
> The result is "False" for the "M","A", and "w". The results for "SM" and
> "BW" are correct. (24 and 26.07) is there something wrong with my statement?
>
> Thanks
>
> Ron B

  #3  
Old February 15th 07, 05:10 PM posted to microsoft.public.excel.worksheet.functions
bj
external usenet poster
 
Posts: 1,397
Default nested "If statement" using text

you may have to use the trim() function to get rid of non visable characters.

=IF(trim(M1)="M",12,IF(trim(M1)="SM",24,IF(trim(M1 )="W",24.2,IF(trim(M1)="BW",26.07,IF(trim(M1)="A", 1)))))

or shorter
=vlookup(trim(M1),{"M","SM","W","BW","A";12,24,24. 2,26.07,1},2,0)
"RonB" wrote:

> This is my expression.
>
> =IF(M1="M",12,IF(M1="SM",24,IF(M1="W",24.2,IF(M1=" BW",26.07,IF(M1="A",1)))))
>
> The result is "False" for the "M","A", and "w". The results for "SM" and
> "BW" are correct. (24 and 26.07) is there something wrong with my statement?
>
> Thanks
>
> Ron B

 




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 On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
embedding "ISERROR" function into an "IF" statement [email protected] Excel Worksheet Functions 8 January 4th 07 12:01 AM
Nested "IF" Statement lajohn63 Excel Worksheet Functions 1 October 6th 06 10:56 AM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM
Text "comparison" operator for "contains" used in an "IF" Function Pawaso Excel Worksheet Functions 3 January 19th 06 06:42 PM
Insert "-" in text "1234567890" to have a output like this"123-456-7890" Alwyn Excel Discussion (Misc queries) 3 October 25th 05 11:36 PM


All times are GMT +1. The time now is 09:24 AM.


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