【问题标题】:How To Add Leading Zeroes To a Fixed Alphanumeric Length In Excel? [duplicate]如何在 Excel 中将前导零添加到固定的字母数字长度? [复制]
【发布时间】:2021-09-29 02:29:43
【问题描述】:

我在 A 列中有以下数字,我需要将它们标准化为 B 列中的固定 8 位字母数字字符串:

    Column A     Column B
1   147731M      0147731M
2   0026146A     0026146A
3   418207L      0418207L
4   0169869M     0160869M
5   2435G        0002435G

我试过=TEXT(A2,"000000")这个公式,但它只在字母被删除时才有效。

【问题讨论】:

  • 假设你总是有最后一个非数字,试试=CONCATENATE(TEXT(LEFT(A1, LEN(A1)-1), "00000000") ,RIGHT(A1, 1))
  • it works only when the letters are removed - 答案也在那里,in a comment 在答案下方。
  • 这返回了一个#VALUE!
  • =RIGHT("00000000" & A1, 8)
  • 这没有给 BigBen

标签: excel


【解决方案1】:

你可以用这个:

=REPT("0", number_of_zeros-LEN(A1)) & A1
 ^--- repeat "0" number_of_zeros you want - length A1 and then concatenate A1

【讨论】:

    猜你喜欢
    • 2012-06-14
    • 2021-02-06
    • 2012-06-12
    • 2011-04-28
    • 1970-01-01
    • 2011-02-03
    • 2012-01-06
    • 1970-01-01
    • 2012-09-24
    相关资源
    最近更新 更多