• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Generate Sequence using Countifs

jonastiger

Member
Hi
I'm using Excel 2019. Please see the Table below.
I need to calculate a sequence number based on a date range, returning a structure like "yy0000". I did use the COUNTIFS function, but it seems that it doesn't work with decimal part number. It only consider the integer part, so when exists two equal integers, the sequence is interrupted. How do I solve this?
Thank You very much in advance
JT

ABCD
E​
DATEDATE (General Format)YearCalculated SequenceShould Be
115/12/2023 02:3545275,10823230001230001
230/12/2023 08:1045290,34023230002230002
313/01/2024 05:2045304,22224240001240001
431/01/2024 10:0045322,41724240002240002
519/02/2024 05:0045341,20824240003240003
609/03/2024 13:2145360,55624240005240004
709/03/2024 23:0545360,96224240005240005
829/03/2024 04:3545380,19124240006240006
901/04/2024 00:0045383,00024240007240007
1009/04/2024 07:2745391,31024240008240008
1116/04/2024 08:0945398,34024240009240009
1210/09/2024 16:1745545,67824240011240010
1310/09/2024 21:0045545,87524240011240011
1411/11/2024 00:3945607,02724240012240012
1508/12/2024 09:0945634,38124240013240013
1626/12/2024 09:0045652,37524240014240014
1730/12/2024 06:4545656,28124240015240015
1808/01/2025 11:3145665,48025250001250001
1911/02/2025 00:1445699,01025250002250002
2015/02/2025 14:2845703,60325250003250003
Formula in D1 (Calculated Sequence):
=C1&TEXT(COUNTIFS($C$1:$C$20;C1;$D$1:$D$20;"<"&D1+1);"0000")
 
Back
Top