View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Sandy Mann Sandy Mann is offline
external usenet poster
 
Posts: 2,345
Default not sure what is wrong

Hi Alex,

Column 3 is "C" so with the formula in Row 5 try:

=IF(LEFT(C5,5)="01752","Local",IF(LEFT(C5,5)="0154 8","Local",IF(LEFT(C5,5)="01803","Local",IF(LEFT(C 5,5)="01845","Local","Long
Distance"))))


A shorter version would be:

=IF(SUM(--(LEFT(C5,5)={"01752","01548","01803","01845"})),"L ocal","Long
Distance")

Note that I am assuming that the 0845 should have been 01845

I am also assuming because of the leading zero that there is other data in
C5 - like "01752 Miles" which would make 01752 text not a number.

If it is actually a number the you don't need the LEFT() function and simply

=IF(C5=1752,"Local",IF(C5=1548,"Local",IF(C5=1803, "Local",IF(C5=1845,"Local","Long
Distance"))))

will work.


--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


with @tiscali.co.uk


"Alex H" wrote in message
...
Hi, No I am obviously getting my perverbials in a twist.
What I was want to is that for the row I am on, if the left 5 chars in
Column 3 = 01548 then local else long ditance
Thanks

Alex

"Sandy Mann" wrote in message
...
Alex,

RC3,5 is not a cell reference. Do you mean RC[3] ? ie three columns to
the right of the cell that the formula is in

Also I assume that "0845" is actually "01845"

Also I do not understand whay you have double quotes when you should only
have single quotes.


--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


with @tiscali.co.uk


"Alex H" wrote in message
...
Hi i have the following code for a cell, but if I enter 01752 into
RC3,5 I am getting "Long distance". Can someone tell me what I'm doing
wrong

thanks
A

"=IF(LEFT(RC3,5)=""01752"",""Local"",IF(LEFT(RC3,5 )=""01548"",""Local"",IF(LEFT(RC3,5)=""01803"",""L ocal"",IF(LEFT(RC3,5)=""0845"",""Local"",""Long
Distance""))))"