View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default custom number format code using letters and numbers

On Mon, 17 Aug 2009 07:26:01 -0700, Foo Foo Daddy <Foo Foo
wrote:

How can I format my cell to display letters, a dash, then #s? For example:
ABC-12345678, or 2DE-12347562, or FG3-46518673?


Without using VBA, your custom format can only hard-code the letters. You
could use up to three conditions related to the number value to decide which
letters to use.

e.g.

Format/Cells/Number/Custom Type:

"ABC-"00000000

or

"2DE-"00000000

You would enter only the 8 digits and the value would look like the above.

If you want to be able to enter the entire string, and have it appear formatted
as above, you could either use a helper column to display your results in
another column e.g. =left(a1,3)&"-"&mid(a1,4,8) Or use a VBA macro to do the
same thing "in situ"
--ron