Date & Time Functions

Mr Roboto

New Member
Joined
Sep 27, 2003
Messages
46
I'm creating a spreadsheet that will connect to a database and extract data based on date time etc. I have to have a start date and time and an end date and time. The end date and time is easy as I can use the =NOW() function which will give you the current date and time, this also tells me when the report was run.
The start date and time is the problem. There will be two files set up one for days and one for nights. I want to be able to run the day shift spreadsheet at any time during the day but have it automatically have a start date of today and a start time of 6:50. The night shift report will be run the next day so the start date and time will be yesterday at 18:50.
I want to have the spreadsheet automatically put this data in the start and end cells when the file is opened. The date and time have to be in the same cell as it is when you use the NOW function
Any suggestions.
 

Some videos you may like

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Gates Is Antichrist

Well-known Member
Joined
Aug 15, 2002
Messages
1,961
=TEXT(NOW(),"mm/dd/yy") & TEXT(TIME(6,50,0)," hh:mm")
or, seriously, folks,
=TEXT(NOW(),"mm/dd/yy") & " 06:50"
and
=TEXT(NOW()-1,"mm/dd/yy") & " 18:50"

You didn't mention if you had to run a night report Monday morning on Friday data. If so, I'm sure you'll survive :cool:
 

Gates Is Antichrist

Well-known Member
Joined
Aug 15, 2002
Messages
1,961
Thank you for the courtesy. The "thank you" rate for successful solutions feels like about 2%. (Incorrect solutions kick the response rate up to at least 97% :LOL: )
 

Watch MrExcel Video

Forum statistics

Threads
1,123,057
Messages
5,599,550
Members
414,316
Latest member
ExcelLee

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