首页 > 其他分享 >WBS自动生成编号

WBS自动生成编号

时间:2023-01-02 16:44:07浏览次数:62  
标签:prevWBS WBS ISERROR OFFSET VALUE 生成 编号 FIND SUBSTITUTE

excel名称管理器中定义A列名称prevWBS,名称管理器中把A2单元引用改为=Sheet1!$A1;生成编号复制公式即可:

1 2 3...

=IF(ISERROR(VALUE(SUBSTITUTE(prevWBS,".",""))),"1",IF(ISERROR(FIND("`",SUBSTITUTE(prevWBS,".","`",1))),TEXT(VALUE(prevWBS)+1,"#"),TEXT(VALUE(LEFT(prevWBS,FIND("`",SUBSTITUTE(prevWBS,".","`",1))-1))+1,"#")))

1.1 ...

=IF(ISERROR(VALUE(SUBSTITUTE(prevWBS,".",""))),"0.1",IF(ISERROR(FIND("`",SUBSTITUTE(prevWBS,".","`",1))),prevWBS&".1",LEFT(prevWBS,FIND("`",SUBSTITUTE(prevWBS,".","`",1)))&IF(ISERROR(FIND("`",SUBSTITUTE(prevWBS,".","`",2))),VALUE(RIGHT(prevWBS,LEN(prevWBS)-FIND("`",SUBSTITUTE(prevWBS,".","`",1))))+1,VALUE(MID(prevWBS,FIND("`",SUBSTITUTE(prevWBS,".","`",1))+1,(FIND("`",SUBSTITUTE(prevWBS,".","`",2))-FIND("`",SUBSTITUTE(prevWBS,".","`",1))-1)))+1)))

1.1.1 ...

=IF(ISERROR(VALUE(SUBSTITUTE(prevWBS,".",""))),"0.0.1",IF(ISERROR(FIND("`",SUBSTITUTE(prevWBS,".","`",2))),prevWBS&".1",LEFT(prevWBS,FIND("`",SUBSTITUTE(prevWBS,".","`",2)))&IF(ISERROR(FIND("`",SUBSTITUTE(prevWBS,".","`",3))),VALUE(RIGHT(prevWBS,LEN(prevWBS)-FIND("`",SUBSTITUTE(prevWBS,".","`",2))))+1,VALUE(MID(prevWBS,FIND("`",SUBSTITUTE(prevWBS,".","`",2))+1,(FIND("`",SUBSTITUTE(prevWBS,".","`",3))-FIND("`",SUBSTITUTE(prevWBS,".","`",2))-1)))+1)))

1.1.1.1 ...

=IF(ISERROR(VALUE(SUBSTITUTE(prevWBS,".",""))),"0.0.0.1",IF(ISERROR(FIND("`",SUBSTITUTE(prevWBS,".","`",3))),prevWBS&".1",LEFT(prevWBS,FIND("`",SUBSTITUTE(prevWBS,".","`",3)))&IF(ISERROR(FIND("`",SUBSTITUTE(prevWBS,".","`",4))),VALUE(RIGHT(prevWBS,LEN(prevWBS)-FIND("`",SUBSTITUTE(prevWBS,".","`",3))))+1,VALUE(MID(prevWBS,FIND("`",SUBSTITUTE(prevWBS,".","`",3))+1,(FIND("`",SUBSTITUTE(prevWBS,".","`",4))-FIND("`",SUBSTITUTE(prevWBS,".","`",3))-1)))+1)))


这是另一个自动生成编号的公式,前一列写入编号级次,公式这一列可以生成正式的任务编号,级次可以无限;

级别 生成编号
1 1
2 1.1
3 1.1.1
4 1.1.1.1
1 2
2 2.1
... ...
=IF(A2="","",IF(A2>OFFSET(A2,-1,0,1,1),IF(OFFSET(B2,-1,0,1,1)="","1",OFFSET(B2,-1,0,1,1))&REPT(".1",A2-MAX(OFFSET(A2,-1,0,1,1),1)),IF(ISERROR(FIND(".",OFFSET(B2,-1,0,1,1))),REPT("1.",A2-1)&IFERROR(VALUE(OFFSET(B2,-1,0,1,1))+1,"1"),IF(A2=1,"",IFERROR(LEFT(OFFSET(B2,-1,0,1,1),FIND("^",SUBSTITUTE(OFFSET(B2,-1,0,1,1),".","^",A2-1))),""))&VALUE(TRIM(MID(SUBSTITUTE(OFFSET(B2,-1,0,1,1),".",REPT(" ",LEN(OFFSET(B2,-1,0,1,1)))),(A2-1)*LEN(OFFSET(B2,-1,0,1,1))+1,LEN(OFFSET(B2,-1,0,1,1)))))+1)))

自定义格式的学习帖子:

http://club.excelhome.net/thread-1201604-1-1.html?jdfwkey=gjemq1

标签:prevWBS,WBS,ISERROR,OFFSET,VALUE,生成,编号,FIND,SUBSTITUTE
From: https://www.cnblogs.com/cloudhan/p/17020126.html

相关文章

  • 从 markdown 中生成目录
    目录1完整代码2使用示例3原理3.1HTML的链接语法3.2markdown列表缩进4代码详解4.1使用「现代」Perl4.2支持utf8编码4.3主循环4.3.1跳过mark......
  • 生成对抗网络GANs的用途
    简介如果说目前深度学习最火,应用最多的领域,莫过于GAN--GenerativeAdversarialNetwork,翻译过来就是生成对抗网络,单单从名字上看,你会觉得它就是一个生成模型,看起来就是用于......
  • 分布式 id 生成器(雪花算法)
    分布式id生成器(雪花算法)有时我们需要能够生成类似MySQL自增ID这样不断增大,同时又不会重复的id。以支持业务中的高并发场景。比较典型的,电商促销时,短时间内会有大量的订......
  • C语言学生成绩管理程序[2023-01-02]
    C语言学生成绩管理程序[2023-01-02]题目一、学生成绩管理程序(学号后三位139-390的选做)任务:利用C语言中相关知识(包括文件,结构体数组等)设计学生成绩管理程序,要求如下:任意......
  • odoo10如何自定义自动生成单据编号
    1.在已有的model中穿件一个字段nameclassqingjiadan(models.Model):_name='qingjia.qingjiadan'name=fields.Char(string='编号',readonly=True)2.创建qingjia_app......
  • Java中动态代理技术生成的类与原始类的区别 (good)
    用动态代理的时候,对它新生成的类长什么样子感到好奇.有幸通过一些资料消除了心里的疑惑.平时工作使用的Spring框架里面有一个AOP(面向切面)的机制,只知道它是把类......
  • 包机制及java生成文档
    包机制为了更好地组织类,Java提供了包机制,用于区别类名的命名空间。包机制的语法格式为:packagepkg1[.pkg2[.pkg3...]];$\color{red}{一般利用公司域名倒置作......
  • mt19937随机数生成_学习笔记
    好文传送门1好文传送门2使用模板:#include<bits/stdc++.h>usingnamespacestd;mt19937rnd(std::random_device{}());intmain(){for(inti=1;i<=10;i++)......
  • 使用 Link Cut Tree 维护最小生成树
    简介本文将简单介绍如何使用LinkCutTree维护动态图最小生成树。思路最小生成树的性质:一个基环树的最小生成树,为将环上边权最大的边删除后所组成的树。Proof:如果删......
  • MornHus--一个野生蒟蒻的生成
    野生蒟蒻一个。蒟蒻的洛谷首页:MornHus写博的内容:主要就是平时写写算法的笔记,有的时候写点数学题,有的时候还会搞一些奇怪的东西【doge】大蒟蒻对小蒟蒻们的话好像也没......