View Single Post
 
Old 01-15-2019, 08:45 AM
ArviLaanemets ArviLaanemets is offline Windows 8 Office 2016
Expert
 
Join Date: May 2017
Posts: 932
ArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant future
Default

It is easy to write a formula which displays a certain date into certain row. Like into some Setup sheet you enter the year number and define the cell as Name, e.g. MyYear. Now on your data sheet into cell A2 you enter the formula
Code:
=IF(DATE(MyYear,1,1) + ROW() -2>TODAY(),"",DATE(MyYear,1,1) + ROW() -2)
and copy it down for 366 rows.

The problem with calculated dates is, that when you need to sort this table, or to add new rows somewhere, or to delete some rows, then data you entered into other columns are moved into new rows, but dates are remaining where they were before - and your data will be attached to wrong dates.

Workarounds:
1. E.g. into cell A2 enter date for January 1st, and into cell A3 enter January 2nd. Select both cells, with mouse activate vertical cross in right lower corner of selection, and drag mouse down - every new record will get a date next to previous. NB! those are real entries, not formulas!
2. Take empty workbook form with formulas to calculate dates into proper cells (dates for whole year). Copy the whole range with data, and use PasteSpecial>Values to replace all formulas with values. Save the workbook form with different name (so you can use the same form for next year again).
3. Write a procedure which fills the table with dates in proper cells. An advanced option is you have a specified workbook, where you enter year number, and click on button - and the procedure called from button click event creates a new workbook properly formatted and prefilled with dates (and other fixed data).
Reply With Quote