Page 1 of 1

User-Defined Cell Format: Letters and Numbers

Posted: Sat Jan 12, 2019 7:55 pm
by BiscuitEater
I want to create a User-Defined Cell Format (Format Cells > Numbers) that will allow a mixture of letters and numbers to display with automatically embedded hyphens.
For example: I want to be able to enter the following "841501F001234" and have it display as "8415-01-F00-1234".

I have tried the custom cell format of "####-##-###-####" and it works great with data of numbers only (such as "8415010001234'), but when the data contains a letter, it fails.
Is there a character other than "#" that I can use in the custom format string that will accept both numbers and letters?
Format Setting
Format Setting

Re: User-Defined Cell Format: Letters and Numbers

Posted: Sat Jan 12, 2019 8:31 pm
by Zizi64
Format Cells > Numbers
That function works with the numbers only.

The strings are strings. The numeric characters have not numeric value in a string. And the separator characters are same parts of a strings as all of the alphanumeric characters are.

If you want not type-in the separator characters, then you can:
- type-in the parts
8415
01
F00
1234
into adjacent columns and then concatenate the parts and the separators by the CONCATENATE() function or by the & operand into helper cells in a helper column.

Code: Select all

=CONCATENATE(A1;"-";B1;"-";C1;"-";D1)

Re: User-Defined Cell Format: Letters and Numbers

Posted: Sat Jan 12, 2019 10:59 pm
by BiscuitEater
Yes, you are correct that the cell data does not have any numeric value. They are stock identification numbers which are usually composed of all numerals, but on occasion will contain one or more letters.
Using separate columns and concatenation would create other problems further on in the process, so would not ease data entry or usage.
However, thank you for your suggestion!