PC Review


Reply
Thread Tools Rate Thread

Dates in excel

 
 
trg103
Guest
Posts: n/a
 
      26th Oct 2003
Okay, here's the problem...

I am creating a spreadsheet that sorts out video rentals. When a video
is rented and the number of nights rental is input, the date that the
film is due for return is put into a cell using the following formula:

=NOW()+NO_OF_NIGHTS

n.b. NO_OF_NIGHTS refers to the cell containing number of nights

Now, the problem with this is that when you open the spradsheet the
next day, the date for due return has been updated by one day. How do i
get my speadsheet to not update the date of return???

Please help :-)



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

 
Reply With Quote
 
 
 
 
Gord Dibben
Guest
Posts: n/a
 
      26th Oct 2003
NOW() is a volatile Function(as you have noticed).

There is no way to prevent it from updating unless you use VBA code.

If you can stand one more cell and one more operation try entering the Date
hard-coded.

e.g. select B1 then hit CRTL + ;(semi-colon) to enter the date. This date
won't change tomorrow.

select C1 and enter =B1 + NO_OF_NIGHTS

If you want to automate it copy/paste this code into the worksheet.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col A
On Error GoTo enditall
If Target.Cells.Column = 1 Then
n = Target.Row
If Range("A" & n).Value <> "" Then
Range("B" & n).Value = Date
Range("C" & n).Value = Date + Range("A" & n)
End If
End If
enditall:
End Sub

Right-click on the sheet tab and select "View Code" and paste the code in.

Now when you input a number into column A(days), column B(day rented) will
have today's date entered and column C(return date) will have the return date
entered.

The Target.Cells.Column = 1 indicates column A. B would be 2, C would be 3
etc. Adjust this and the "A", "B" and "C" to suit your layout.

Gord Dibben XL2002

On Sun, 26 Oct 2003 16:22:23 -0500, trg103
<(E-Mail Removed)> wrote:

>Okay, here's the problem...
>
>I am creating a spreadsheet that sorts out video rentals. When a video
>is rented and the number of nights rental is input, the date that the
>film is due for return is put into a cell using the following formula:
>
>=NOW()+NO_OF_NIGHTS
>
>n.b. NO_OF_NIGHTS refers to the cell containing number of nights
>
>Now, the problem with this is that when you open the spradsheet the
>next day, the date for due return has been updated by one day. How do i
>get my speadsheet to not update the date of return???
>
>Please help :-)
>
>
>
>------------------------------------------------
>~~ Message posted from http://www.ExcelTip.com/
>~~ View and post usenet messages directly from http://www.ExcelForum.com/


 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      26th Oct 2003
One way is to just enter the date & time directly:

These work for me in my USA keyboard:

ctrl-semicolon will put the date and control-colon (ctrl-shift-semicolon) will
put the time.

(do you really need the time, too?)

if yes,
Ctrl-semicolon spacebar ctrl-colon

if no, then just:
ctrl-semicolon



trg103 wrote:
>
> Okay, here's the problem...
>
> I am creating a spreadsheet that sorts out video rentals. When a video
> is rented and the number of nights rental is input, the date that the
> film is due for return is put into a cell using the following formula:
>
> =NOW()+NO_OF_NIGHTS
>
> n.b. NO_OF_NIGHTS refers to the cell containing number of nights
>
> Now, the problem with this is that when you open the spradsheet the
> next day, the date for due return has been updated by one day. How do i
> get my speadsheet to not update the date of return???
>
> Please help :-)
>
> ------------------------------------------------
> ~~ Message posted from http://www.ExcelTip.com/
> ~~ View and post usenet messages directly from http://www.ExcelForum.com/


--

Dave Peterson
(E-Mail Removed)
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Dates to Access Dates (Julian) Michael Kintner Microsoft Access 3 28th Sep 2005 02:01 PM
How do I get the dates on an excel chart to stay as dates instead. =?Utf-8?B?UmFuaQ==?= Microsoft Excel Charting 1 20th Sep 2005 05:56 PM
Excel: counting cells which have dates between specified dates Jacqueline Microsoft Excel Misc 2 11th Aug 2004 12:15 PM
transform text dates into Excel dates =?Utf-8?B?RGFuaWVsIFA=?= Microsoft Excel Misc 3 17th Apr 2004 12:28 AM
How to make Excel treat the dates AS DATES which are taken from a Web Page ? sorabh Microsoft Excel Misc 5 9th Apr 2004 03:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:54 AM.