If Time then report number using Now()

TheToeOfPooh

Active Member
Joined
May 21, 2004
Messages
254
After some thought and advice from this board (thanks Andrew) I have been asked to see if the following is possible.

I am trying to produce a calculation that uses Now() to number reports.

If the report is run between midnight last night and mid day today (am) the number will be 1

If report is run between mid day and midnight today (pm) the number will be 2.

Can this be done and if so how would I do it please?
Basically there should always be a report 1 and 2 run each day, more than once is acceptable so two sets of a report 1 will be fine.

Bernard
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Hi Bernard

Me again! You can calculate this on the report by adding a new text box into the header (or footer), and entering the following as the control source :

=IIf(Time()<=0.5,1,2)

You could add this field into the underlying query instead of the report using the same code.

Are you going to want to store this value in a table?

Andrew :)
 
Upvote 0
Plus you can combine the expression with text etc like this :

"Report Number " & IIf(Time()<=0.5,1,2) & " for " & Date()

Andrew
 
Upvote 0
Andrew - You are a wonderful man :)

I have taken your first sugestion and everyone here is pleased with result.

We decided on just the number (as the reports already contain alot of images, text and data).

I used an unbound text box as sugested and viola!

Thank you for helping me again.

Bernard
 
Upvote 0

Forum statistics

Threads
1,221,852
Messages
6,162,431
Members
451,765
Latest member
craigvan888

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