sequence numbers?

mydear

New Member
Joined
Apr 8, 2015
Messages
5
I need to automatically generate a 5-character value for my Business Key. Without any user interaction.

2 character -> from 01,02,03,04 to 05
+
3 character -> Sequential Number (001,002,003).

The Sequential Number must reset on each new day.


This is my Example:
ComboBox= 01 or 02 or 03 or 04 or 05

if ComboBox= 01 and MyDate = 4/6/2015
MyTable

PK Castumer_Number Seq_Number
1 1 01-001
2 2 01-002
3 3 01-003

if ComboBox= 02 and MyDate = 4/6/2015
MyTable
PK Castumer_Number Seq_Number
1 4 02-001
2 5 02-002
3 6 02-003

if ComboBox= 01 and MyDate = 4/6/2015
MyTable
PK Castumer_Number Seq_Number
1 7 01-004
2 8 01-005
3 9 01-006

and The Sequential Number must reset on each new day.

I hope it's clear now
thanks
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
I would create a table to use for this. Each time you need a number, get the max, add one, and don't forget to insert your incremented value back into the table as the new max. Theoretically the table should be locked if it is possible for two users to be "getting" the next sequence at the same time - so you don't hand out the same number twice.
 
Upvote 0

Forum statistics

Threads
1,221,889
Messages
6,162,624
Members
451,778
Latest member
ragananthony7911

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top