View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Roger Ottaway[_2_] Roger Ottaway[_2_] is offline
external usenet poster
 
Posts: 3
Default formatting macro

Dear Greg

I am not an excel "expert" but seeing that you have had no replies, I have
had a similar problem so this may help. In my case I had a number which was
in effect several numbers all joined together to give one number about 35
digits long. Excel truncated the whole thing into one number and gave it in
scientific notation so I lost the precision. The solution was to format the
number as a text field, and then use the MID function to take out sections
of the number. each section into a different column, and then put it all
back together again as a string.

In your case, if you have an "a" at the end of your number Excel should
regard the "number" as a string and automatically format it as a text field,
but you may want to check that out. You can simply write three MID strings
and put it all together as one string with your dash between each set of
numbers (which is one string) and add the character a at the end. it is easy
enough if all of the original numbers are the same length. if the length is
variable you need to use the LEN function as well. for example, assuming all
of your numbers are in the style of 999888777a ... it would be formated as a
text field in cell A1 and then use the following in cell A2

=MID(A1,1,3)&"-"&MID(A1,4,3)&"-"&MID(A1,7,3)&"a"

because you are adding a character at the end, it has to be a text field. I
hope this helps

Roger


"Greg Brow" wrote in message
...
Hi all

I have a series of numbers 123456789 and it is followed with a letter a

I need to show on a worksheet in this format 123-456-789a I cant work out
how to set the cell i have tried 000-000-000 but not sure how to get it to
recognise the letter after

Thanks in advance

greg