Share via

Text to column removes leading zero despite selecting "text"

Anonymous
2024-03-07T12:00:34+00:00

I have a very long column of 5-digit hex values that I need to make into 4-digit hex values by shaving off the leading "A" from every one of those values (~65000 values). Every single one of the originating hex values starts with an A, if that matters.

I select text to columns, fixed width, select just the first character as the split, then select the output to be "text" and yet it always removes the leading zeroes.

A0000 becomes 1

A0001 becomes 2

etc.

instead of (what I want):

A0001 becomes 0001

A0002 becomes 0002

I tried selecting every cell inside the excel document, then format those cells as text, then do the above text-to-columns with the output as text but it always removes the leading zeroes.

I tried copying the original values, then pasting them as "only values", to be sure I didn't have some strange formatting, then doing the same split, and yet it removes the leading zeroes.

This has to be a bug, right?

Microsoft 365 and Office | Excel | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

3 answers

Sort by: Most helpful
  1. Anonymous
    2024-03-07T13:09:32+00:00

    I figured out the cause.

    In Options, under "Data" and "Automatic data conversion", the default for "Remove leading zeros and convert to a number" was enabled. Unchecking that option worked.

    Which begs the question, why is data to columns affected by a setting that sounds like it should only affect numbers coming from outside of excel?

    In any case, I solved my own issue.

    40+ people found this answer helpful.
    0 comments No comments
  2. HansV 462.6K Reputation points MVP Volunteer Moderator
    2024-03-07T12:08:37+00:00

    It works for me - Excel in Microsoft 365 version 2402 on Windows 11 Home:

    Result:

    2 people found this answer helpful.
    0 comments No comments
  3. HansV 462.6K Reputation points MVP Volunteer Moderator
    2024-03-07T13:12:43+00:00

    Thanks for sharing the cause and solution.

    0 comments No comments