+ Reply to Thread
Results 1 to 2 of 2

Custom Cell format for hyphenated codes including letters and numbers

  1. #1
    Registered User
    Join Date
    04-28-2021
    Location
    Bristol
    MS-Off Ver
    Office 2016
    Posts
    2

    Custom Cell format for hyphenated codes including letters and numbers

    Hi,

    Im a novice user of excel so if this gets complicated i might struggle to follow.

    im trying to populate an excel document with codes that look like this:

    FTH-DSA-XX-ZZ-FF-A-0200
    FTH-DSA-XX-XX-FF-A-0201
    FTH-DSA-XX-01-FF-A-0202
    FTH-DSA-XX-02-FF-A-0203

    please note the overall length of the codes will be the same and the characters between the hyphens will also be the same and in the same position along the code.

    I've tried to create a custom formula within the format cells dialogue box
    but it only works with numbers using ###-###-##-##-##-##-#-####
    how do i do this with both numbers and letters?

    i suppose the goal is to be able to write
    FTHDSAXX01FFA1200 click return and have the codes appear with the hyphens.

    1 other issue is that some excel documents will have hundreds of these codes
    the final number counts up from 0200 to 0201 etc in this case. but some of the other characters change from XX to ZZ for instance. so whilst im able to 'drag copy' to popoulate the codes. i will have to edit each one to replace XX with ZZ or ZZ with 01 to name two examples
    any suggestions of how to speed up inputting these codes would be gratefuly recieved.

  2. #2
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Custom Cell format for hyphenated codes including letters and numbers

    Welcome to the forum.

    There isn't any custom formatting for 'make this a letter' (unlike 'make this a number' which can use '0' or '?' or '#' depending on what's needed).
    You can specify a particular letter, but not 'this must be letter, any letter'.

    It's also worth noting that custom formatting only changes how Excel displays a number; it doesn't change how the number is actually stored.
    For example, if you format AB123 as A-B-12-3 then copy the cell and paste it into Notepad, you'll get AB123, not A-B-12-3.

    Taking both of those points, if you want to enter the code without hyphens and have Excel enter the hyphens, it would be best to do this in another column.
    If you have your first code (without hyphens) in cell A2, put this in cell B2:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Then drag it down as far as you need.

    It works like this:
    LEFT(A2,3) = take the first 3 characters of A2
    &"-"& = add a hyphen
    MID(A2,4,3) = starting at character 4, take another three characters
    repeat similarly for the other middle parts before finishing with
    RIGHT(A2,4) = take the last 4 characters of A2

    If the FTH-DSA-XX part stays exactly the same for all codes, then you could just enter the part after that in column A:
    01FFA1200
    and use this in column B instead:
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    Regarding your last issue, if there's a pattern to the changes from XX to ZZ etc, then it might be possible to semi-automate this (perhaps using IF statements or something) but we'd need to know the logic (i.e. the pattern) behind it.

    Hope that helps.
    Regards,
    Aardigspook

    I recently started a new job so am a bit busy and may not reply quickly. Sorry - it's not personal - I will reply eventually.
    If your problem is solved, please go to 'Thread Tools' above your first post and 'Mark this Thread as Solved'.
    If you use commas as your decimal separator (1,23 instead of 1.23) then please replace commas with semi-colons in your formulae.
    You don't need to give me rep if I helped, but a thank-you is nice.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Custom Format with Numbers and Letters?
    By anon12398 in forum Excel General
    Replies: 9
    Last Post: 03-07-2019, 06:49 AM
  2. [SOLVED] Concatenate not including all Zeros in 4digit custom format
    By DoraExplorExcel in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-17-2017, 01:32 PM
  3. [SOLVED] Highest Value in Row, Including Letters and Numbers
    By BettyC in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 02-10-2016, 12:06 PM
  4. Custom format for two numbers in one cell
    By BigPizzaMike in forum Excel General
    Replies: 2
    Last Post: 08-21-2015, 11:48 AM
  5. Custom format UK telephone numbers/UK post codes
    By Ju1cy in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-13-2013, 07:00 AM
  6. Custom Format Numbers for account codes
    By karstens in forum Excel General
    Replies: 2
    Last Post: 01-14-2011, 04:15 PM
  7. Excel custom format with letters and numbers
    By pdrodrig in forum Excel General
    Replies: 1
    Last Post: 06-11-2009, 08:08 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1