View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
bj bj is offline
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

 
ExcelBanter Database Error
Database Error Database error
The ExcelBanter database has encountered a problem.

Please try the following:
  • Load the page again by clicking the Refresh button in your web browser.
  • Open the www.excelbanter.com home page, then try to open another page.
  • Click the Back button to try another link.
The www.excelbanter.com forum technical staff have been notified of the error, though you may contact them if the problem persists.
 
We apologise for any inconvenience.