Day Month Year???

carlzoll

Board Regular
Joined
Oct 22, 2004
Messages
65
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

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
60,193
Office Version
  1. 365
Platform
  1. Windows
Try formatting the cell as Custom: yymmdd
 

carlzoll

Board Regular
Joined
Oct 22, 2004
Messages
65
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

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
60,193
Office Version
  1. 365
Platform
  1. Windows
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
Joined
Oct 22, 2004
Messages
65

ADVERTISEMENT

Yes, everyday the number will start back at "CZ1"
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
60,193
Office Version
  1. 365
Platform
  1. Windows
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
Joined
Oct 22, 2004
Messages
65

ADVERTISEMENT

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

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
60,193
Office Version
  1. 365
Platform
  1. Windows
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
...
 

Forum statistics

Threads
1,148,530
Messages
5,747,234
Members
424,070
Latest member
smanni3

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
Top