简体   繁体   English

Excel-如何增加唯一序列号的数字

[英]Excel-How to increment a digit of a unique serial number

FPS032Y22886104772-B-1
FPS032Y22904104773-B-1-E2
FPS032Y22904104774-B-1
FPS032Y22886104775-B-1
FPS032Y22886104776-B-1
FPS032Y22886104777-B-1
FPS032Y22886104778-B-1

I would like to increment a digit at a specific position of a unique serial number while keeping the rest of the serial intact.我想在唯一序列号的特定 position 处增加一个数字,同时保持序列号的 rest 完好无损。 Eg in the examples above the digit before the first '-' needs to be incremented.例如,在上面的示例中,第一个“-”之前的数字需要递增。

What type of formula is suitable for that?什么类型的公式适合这种情况?

Assuming that "number of number at end" implies incrementing '104788' (ie "-B-1" etc. then use:假设“末尾的数字数”意味着递增“104788”(即“-B-1”等,然后使用:

=LET(x_,FILTERXML("<x><y>"&SUBSTITUTE(B2,"-B-1","</y><y>")&"</y></x>","//y"),y_,INDEX(x_,COUNTA(x_)-1),z_,SUBSTITUTE(y_,"FPS032Y",""),w_,z_+1,SUBSTITUTE(B2,z_,w_))

RequiresOffice 35 cop5 Excel ompatibility).需要Office 35 cop5 Excel 兼容性)。 If, instead, you meant to refer to the numers ending 772,773,... etc. (which I相反,如果您的意思是指以 772,773、... 等结尾的数字(我

方程


Calculation计算

In turn, this uses:反过来,这使用:

  1. FilterXML to split the serial chain (delimitter = '-') FilterXML 拆分串行链(分隔符 = '-')
  2. Index to identiy the final such serial 1标识最终此类序列1的索引
  3. Substitute to remove unwanted text before adding 1 and sustituting result ack ito origina serial code替换在加1之前删除不需要的文本并替换结果ack ito origina serial code

Is there a possibility you can use this formula:有没有可能你可以使用这个公式:

="FPS032Y22886104772-B-" & ROW()

As you can see, I just take the prefix and add the rownumber of the cell, how easy can it be?如您所见,我只是取前缀并添加单元格的行号,这有多容易? :-) :-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM