#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Count dates

I need to keep track of how many dates the local swimming pool is open. When
I type in a date (for instance, May 15) in cell A1, I want cell B1 to tell me
that is day 1. When I enter the next date (May 16) in A1, I want B1 to tell
me it is day 2.
How can I keep track of how many days the pool is open?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 461
Default Count dates

In A1 enter the beginning date you want to count from
In B1 enter =TODAY()
In C1 enter =B1-A1

Make sure the number format is set to general in cell C1

"poolgirl" wrote:

I need to keep track of how many dates the local swimming pool is open. When
I type in a date (for instance, May 15) in cell A1, I want cell B1 to tell me
that is day 1. When I enter the next date (May 16) in A1, I want B1 to tell
me it is day 2.
How can I keep track of how many days the pool is open?

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Count dates

Looks like you want B1 to be a counter. Each time you change the date in A1,
B1 should increase by one. Use the following Worksheet macro:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Range("A1"), Target) Is Nothing Then
Application.EnableEvents = False
Range("B1").Value = Range("B1").Value + 1
Application.EnableEvents = True
End If
End Sub



Because it is worksheet code, it is very easy to install and use:

1. right-click the tab name near the bottom of the window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

Now try entering material in cell A1. If you have any concerns, first try
it on a trial worksheet.

If you save the workbook, the macro will be saved with it.


To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm




--
Gary''s Student - gsnu200719


"poolgirl" wrote:

I need to keep track of how many dates the local swimming pool is open. When
I type in a date (for instance, May 15) in cell A1, I want cell B1 to tell me
that is day 1. When I enter the next date (May 16) in A1, I want B1 to tell
me it is day 2.
How can I keep track of how many days the pool is open?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Count of Dates Zoltan Excel Discussion (Misc queries) 1 March 13th 07 12:41 AM
need to convert list of dates to count no. of dates by week neowok Excel Worksheet Functions 13 January 30th 06 03:54 PM
count dates rabol New Users to Excel 3 March 6th 05 06:25 PM
How do a count dates? Aviator Excel Discussion (Misc queries) 2 January 5th 05 04:17 PM
How do a count dates? Peo Sjoblom Excel Discussion (Misc queries) 0 December 27th 04 05:13 PM


All times are GMT +1. The time now is 02:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"