LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Ping - Bernie (or any other sage)

Bernie,
I am still having trouble ... the first variable StartDate works fine but
when I try to use the second variable EndDate I get a zero result ... (see
code below) ... Can you identify the problem for please before I am
completely bald.

Regards & TIA

Jim Burton

------------------------------------

Sub WhyNotThis()
Dim StartDate As String
Dim EndDate As String

StartDate = DateAdd("d", -Day(Date) + 1, Date)
EndDate = DateAdd("m", 1, StartDate)
EndDate = DateAdd("d", -1, EndDate)

MsgBox "Start Date is " & StartDate & Chr(13) & Chr(13) & "End Date is " &
EndDate

MsgBox "Using your first code: " &
Evaluate("SUMPRODUCT(--(A2:A100=--""2005-06-01""),--(A2:A100<=--""2005-06-30""),
--(F2:F100=""Cleared""),--(D2:D1000),D2:D100)")
MsgBox "Using the variable StartDate: " &
Evaluate("SUMPRODUCT(--(A2:A100=--" & StartDate &
"),--(A2:A100<=--""2005-06-30""), --(F2:F100=""Cleared""),--(D2:D1000),D2:D100)")

'What's going amiss here ?

MsgBox "Using the variable EndDate: " &
Evaluate("SUMPRODUCT(--(A2:A100=--""2005-06-01""),--(A2:A100<=--" & EndDate
& "), --(F2:F100=""Cleared""),--(D2:D1000),D2:D100)")
MsgBox "Using the both variables: " & Evaluate("SUMPRODUCT(--(A2:A100=--" &
StartDate & "),--(A2:A100<=--" & EndDate &
"), --(F2:F100=""Cleared""),--(D2:D1000),D2:D100)")

End Sub


 
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
PING: Bernie Deitrick - Calloway Golf Scoring Duncs Excel Discussion (Misc queries) 6 August 1st 07 03:00 AM
Bernie Deitrick CBrausa Excel Discussion (Misc queries) 1 May 5th 06 10:27 PM
Thanks Bernie Jodi Excel Programming 7 April 12th 05 08:32 PM
Bernie My New Macro JulianB Excel Worksheet Functions 1 March 8th 05 09:41 PM
Bernie Deitrick Trying to excel in life but need help Excel Worksheet Functions 1 January 19th 05 03:27 PM


All times are GMT +1. The time now is 06:24 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"