我还没有做过excel编程。我有一张表如下:
CreatedTime Id
05/04/2015 1000
05/10/2015 1000
05/12/2015 1000
05/01/2015 1001
05/05/2015 1001
05/03/2015 1002
05/13/2015 1002
我想要的是:
CreatedTime Id Days_Between_Actions
05/04/2015 1000 4
05/10/2015 1000 6
05/12/2015 1000 2
05/01/2015 1001 1
05/05/2015 1001 4
05/03/2015 1002 3
05/13/2015 1002 10
此公式适用于与每个“Id”相对应的条目,但每个“Id”的第一个条目除外。 =IF(A3 = "05/01/2015",1,DAYS(A3,A2))
。但对于与每个'Id'对应的第一个条目,公式必须为=IF(A2 = "05/01/2015",1,DAYS(A2,"05/01/2015")+1)
。
我正在使用像 - >这样的查询select distinct convert (date, CreatedTime) as CreatedTime, Id from database.table where createdtime between '2015-05-01 00:00:00' and '2015-05-15 23:59:59' order by Id, CreatedTime
答案 0 :(得分:2)
excel中的解决方案,只有一个公式适用于所有行:
padZerosToLength(1, 6, 0); ===> 000001
padZerosToLength(1, 6, 1); ===> 111111
padZerosToLength(1, 6, "x"); ===> xxxxx1
padZerosToLength(1, 6, "."); ===> .....1
padZerosToLength(1, 6, " "); ===> 1
padZerosToLength(1, 6, "\u25CF"); ===> ●●●●●1