# Day Month Year???

#### carlzoll

##### Board Regular
I am trying to make my spreadsheet autonumber my orders by date. My autonumber format needs to be for example:
todays date is: 1/20/05

I want to have my number read: 050120

How do I do this?

### Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

#### Joe4

Try formatting the cell as Custom: yymmdd

#### carlzoll

##### Board Regular
I tried that but this number will be used as an autonumbered cell.

My full number looks like this: 050120-CZ1 and if I make another purchase order the number would be 050120-CZ2 and so on. But I would like to have this done in a formula rather than formating a cell.

Can anyone help?

#### Joe4

Can you be a bit more descriptive on the rules for your autonumber? Is it going to restart at zero for every single day?

Providing some real example of exactly how you want it to work might be helpful.

#### carlzoll

##### Board Regular
Yes, everyday the number will start back at "CZ1"

#### Joe4

How is a new row added? Is there some event that triggers it automatically, or do you just want the value to pop-up when someone enters something on that row?

#### carlzoll

##### Board Regular
The number will be triggered by a button "Process PO". I have a calculation page (worksheet) that I can use to store a counter. I'm just not sure how to do this with code.

#### Joe4

Here is an Excel formula that does what I think you want:

=IF(LEFT(A1,6)=TEXT(NOW(),"yymmdd"),TEXT(NOW(),"yymmdd")&"CZ"&MID(A1,9,LEN(A1)-8)+1,TEXT(NOW(),"yymmdd")&"CZ1")

This assumes that you have a value in A1, and this formula is being entered into cell A2. Adjust accordingly.

Basically, what this does is look at the value in the cell above it. If today is the same date as the cell above, it will add one to the counter at the end of the counter. Otherwise, it will start over at 1 again. So the result would look something like this:

A1: 050119CZ1
A2: 050120CZ1
A3: 050120CZ2
...

#### carlzoll

##### Board Regular
Thanks, I'll give that a try.

I appreciate it.

Replies
2
Views
328
Replies
3
Views
195
Replies
6
Views
149
Replies
6
Views
177
Replies
0
Views
141

1,181,790
Messages
5,932,062
Members
436,816
Latest member
Composh

### 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.

### Which adblocker are you using?

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

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