View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
joeu2004 joeu2004 is offline
external usenet poster
 
Posts: 2,059
Default convert text to number in excel

On Jan 13, 8:03*am, The IC Teacher
wrote:
I have one of four chars displayed in any cell "f", "p", "m", "d",
i wish to convert "f" to 0 "p" to 1 "m" to 2 and "d" to 3


=find(A1,"fpmd")-1

If the cell might not contain any of those characters, then:

=if(or(A1="",iserror(find(A1,"fpmd")), "", find(A1,"fpmd")-1)

I believe a more elegant formula is possible in Excel 2007.