Eksistenze
New Member
- Joined
- Feb 17, 2021
- Messages
- 1
- Office Version
- 2013
- Platform
- Windows
Hello,
I am trying to generate a serial number for some entries based on a date that is entered in column H. I have done this using the formulas below:
(This is in my DATA sheet in column E where I just have sequential numbers in column D)
=YEAR('2021 CSEC DISCREPANCY LIST'!H2)&"-"&TEXT(INDIRECT("D"&(2+COUNTIF('2021 CSEC DISCREPANCY LIST'!A$1:A1,YEAR('2021 CSEC DISCREPANCY LIST'!H2)&"-"&"*"))),"000")
(Where the actual serial number goes in the main sheet)
=IF(COUNTA(B2:L2)=0,"ZZZ",'DATA (DO NOT TOUCH)'!E$2)
The problem comes when the entries are sorted, it creates a circular reference and breaks the formula.
I am trying to come up with a VBA solution that generates the serial numbers based on the year in column H so that each time a new entry is added, it ups the serial number by one.
Example:
2020-001
2020-002
2021-001
2020-003
2021-002
Thank you!
I am trying to generate a serial number for some entries based on a date that is entered in column H. I have done this using the formulas below:
(This is in my DATA sheet in column E where I just have sequential numbers in column D)
=YEAR('2021 CSEC DISCREPANCY LIST'!H2)&"-"&TEXT(INDIRECT("D"&(2+COUNTIF('2021 CSEC DISCREPANCY LIST'!A$1:A1,YEAR('2021 CSEC DISCREPANCY LIST'!H2)&"-"&"*"))),"000")
(Where the actual serial number goes in the main sheet)
=IF(COUNTA(B2:L2)=0,"ZZZ",'DATA (DO NOT TOUCH)'!E$2)
The problem comes when the entries are sorted, it creates a circular reference and breaks the formula.
I am trying to come up with a VBA solution that generates the serial numbers based on the year in column H so that each time a new entry is added, it ups the serial number by one.
Example:
2020-001
2020-002
2021-001
2020-003
2021-002
Thank you!