Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Les Les is offline
external usenet poster
 
Posts: 240
Default Update Dates

I have 2 cells next to each other called nextyearfromdate and nextyeartodate. The cells are linked to calendars (Calendar Control 9.0).
In another cell a formula calculates the number of months in the date period which fall on a Thursdays between the 15th and 21st only of the month:-

=IF(COUNT(nextyearfromdate:nextyeartodate)=2,SUMPR ODUCT(--(WEEKDAY(ROW(INDIRECT(nextyearfromdate & ":" & nextyeartodate)))=5),--(DAY(ROW(INDIRECT(nextyearfromdate & ":" & nextyeartodate)))=15),--(DAY(ROW(INDIRECT(nextyearfromdate & ":" & nextyeartodate)))<=21)),"enter date")

This formula works fine when you type the dates in the cells, but when a date/dates are chosen from the calendar/s you need to click in the formula bar then press Enter to get the formula to work.

Can anyone tell me how to get this to work automatically?
--
Les
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Update Dates

The problem with the calendar control is that it returns dates as text. Even though the cell is still formatted as date, if you make the cell wider, you'll notice that the calendar linked cell aligns the value to the left (as text) instead of to the right as with numeric/date values.
A workarround:
- say your linked cells are A2 and B2 (NextYearFromDate, NextYearToDate).
- in A1: =datevalue(A2)
- in B1: = datevalue(B2)
- name A1 and B1, NextYearFromDate and NextYearToDate, instead of A2 and B2.
(or give new names and have your formula work on these new names instead)
- hide row 1

Regards,
Sebastien
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
Update dates annually Misty Sunshine Excel Worksheet Functions 2 August 31st 10 10:56 AM
Update 2009 dates to 2010 dates EllenM Excel Discussion (Misc queries) 7 October 22nd 09 02:57 PM
No update of dates [email protected] Excel Discussion (Misc queries) 7 May 29th 05 06:36 AM
Dates that automatically update ... Artanis Excel Discussion (Misc queries) 3 March 10th 05 12:21 PM
MACRO TO UPDATE DATES ! jay dean Excel Programming 3 October 30th 03 09:57 PM


All times are GMT +1. The time now is 09:40 PM.

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"