Share via

How to remove spaces in barcode font in Excel?

Kai Ponte 0 Reputation points
2026-03-21T04:55:11.4266667+00:00

I am creating an Excel spreadsheet using a Free 3 of 9 barcode font for me to print and have handy at my retail store. I want to be able to scan the barcode using our handheld scanner to check inventory.

When I create the cell I use the value of the item number plus asterisks on each side. I've done this for years but am missing something.

So, I have the barcode value in column K. My barcode in column L looks like: ="" & K3 & ""

This is supposed to create a barcode font using the 3 of 9 font I choose. However, there are spaces put in the cell. To create a barcode, I am supposed to use the value plus asterisk characters on each side.

any ideas why there's a space?

User's image

Microsoft 365 and Office | Excel | For business | Windows
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Vivian-HT 14,035 Reputation points Microsoft External Staff Moderator
    2026-03-21T05:59:51.4633333+00:00

    Dear @Kai Ponte,

    Based on the Code 39 documentation, I recommend trying the alternative start and stop characters supported by some Code 39 fonts. In Microsoft Excel, Code 39 barcodes can be dynamically generated by appending start and stop characters using a calculated formula.

    If your data is in cell C3, please try using the following formula instead. For example: ="("&K3&")"

    User's image

    For detailed, step‑by‑step instructions on creating a 3 of 9 (Code 39) barcode in Excel, I recommend following the guide below and re‑creating the setup exactly as shown: How to Create a Barcode Using the 3 of 9 Font in Excel - ExcelDemy

    For reference: Code 39 Barcode FAQ & Tutorial | BarcodeFAQ.com

    Disclaimer: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link

    If the issue still persists, could you please confirm these questions below to help me diagnose the issue more effectively:

    • How is the item number in column K being entered? Is it typed manually, imported from another system (POS, accounting software), or copied from an email or website?
    • If you temporarily replace the barcode font with a standard font (like Calibri), do you visibly see spaces before or after the value?
    • Have you tried testing this on another device, or by creating a new workbook, to see if the same issue happens?

    Note: Please understand that as a forum moderator, my role is to provide general guidance and troubleshooting support. I don’t have access to internal systems or backend tools, and I appreciate your understanding of these limits.

    I hope the information shared helps point you in the right direction. Please try the steps above and let me know if they work. If not, we can continue working together to narrow this down.

    The first response may not always resolve the issue right away, but with your help and more details, we can work toward a solution.

    Thank you for your patience and understanding. I'm looking forward for your reply.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".   

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Q&A Assist
    2026-03-21T04:55:36.2833333+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The spaces are almost certainly coming from hidden or non‑printing characters in the value in column K (for example, leading/trailing spaces that are not obvious in the normal view). When those characters are included between the asterisks, the barcode font renders them as gaps in the bars.

    Clean the data in column K, then rebuild the barcode string. For example, in L3 use a formula that strips spaces and non‑printing characters from K3 before adding the asterisks:

    ="*" & TRIM(CLEAN(SUBSTITUTE(K3,CHAR(160)," "))) & "*"
    

    Then fill this formula down. This combination:

    • CLEAN removes non‑printing characters.
    • SUBSTITUTE(K3,CHAR(160)," ") converts non‑breaking spaces (often imported from other systems) to normal spaces.
    • TRIM removes leading, trailing, and repeated internal spaces.

    After that, apply the Free 3 of 9 barcode font only to column L. The bars should render without extra gaps and scan correctly.

    If the source values in K are meant to be purely numeric, also ensure they are stored as numbers (not text with hidden characters) by cleaning them in a helper column first and then referencing that cleaned column in the barcode formula.


    References:

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.