Put number and autocomplete to nearest date?

Magnamuz

New Member
Joined
Oct 8, 2019
Messages
2
Hi, part of my job is to put dates to documents that were made in the past 15 days or so, and I'd like to know if there's a way to put, for example, if today is 08/10/2019, then I'd put a 4 and it should assume that I want to put 04/10/2019, or a 26 and it should assume that is 26/09/2019 (from last month, obviously). For the moment it autocompletes to xx/01/1990... :(

Thanks!
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Hi & welcome to MrExcel.
You could use a formula in another cell like
=DATE(YEAR(TODAY()),MONTH(TODAY())-IF(D2>DAY(TODAY()),1,0),D2)

Where D2 is the cell with the number.
 
Upvote 0
Welcome to the Board!

It is important to understand how dates work in Excel. Dates are actually stored as numbers in Excel, specifically the number of days since January 0, 1900. They just then have a date format applied to them to look that way.
You can see this easily by going to any valid date in Excel, and changing the format to "General". Then you will see the date as Excel does (the number of days since January 0, 1900).

So, if you enter a 4, on cell with date format dd/mm/yyyy, it will return 04/01/1900.

Without the use of a helper cell, I think in order to do what you want, you would need to apply some VBA. If that is something you would be interested in, please let us know and provide more details, such as what is the cut-off/criteria for determining whether it should be this month or last month.
 
Last edited:
Upvote 0
Without the use of a helper cell, I think in order to do what you want, you would need to apply some VBA. If that is something you would be interested in, please let us know and provide more details, such as what is the cut-off/criteria for determining whether it should be this month or last month.

I don't know what a VBA is, sorry.

The idea is to fill in a table for the internal-quality sector that asks for a form with several dates, such as document starting date, completion date, processed date, etc. So I have to put 01/10/2019, 03/10/2019 and 08/10/2019 in several columns, without formulas in those columns.

And the criteria for choosing the month would be to put a day that hasn’t come yet, for example, if today is 08/10/2019 and I put the number 12, then it should assume that I mean 12/09/2019 cause 12/10/2019 hasn’t come yet (assuming excel can check the current date, obviously).

I suppose I was looking for an internal way to do this, not a formula cause I'll be needing other columns to do this. As it was said, it counts from 01/01/1900 onwards and I'd like it to count down from current date instead, somehow, now I'm not thinking it's possible...

Thanks for the answers so far.
 
Upvote 0
If I understand you correctly, I think what you are talking about requires the use of VBA (background code that runs when we want it to) or "helper" formulas, as Fluff suggested, as you are asking Excel to behave in a way that is different than it was designed to do.

If the sole purpose is to save a few keystrokes, so that the user only has to enter one number instead of a full date, consider adding a Date Picker instead.
See: https://www.ablebits.com/office-addins-blog/2016/10/12/insert-calendar-excel-datepicker-template/
 
Upvote 0

Forum statistics

Threads
1,214,567
Messages
6,120,268
Members
448,953
Latest member
Dutchie_1

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