Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Date issue with if Statement

Hi,

I have a problem that I just can't figure out.

I have a data list and I only want to pick out entries which fall on a
specific date or before that but for some reason its not picking up the
entries. It works if I use an = operand but not for <= operand inorder
to get the previous dates aswell.

syntax

Filter_Date = "27/08/2006"
Data_Date = 'Value taken from workbook

if Data_Date <= Filter_Date then
code
endif

Can anyone shed any light on this??

Thanks

Dwight

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Date issue with if Statement

Hello Dwight, try using the DATEDIF function as I believe you cannot
compare dates without it.

Dewey wrote:
Hi,

I have a problem that I just can't figure out.

I have a data list and I only want to pick out entries which fall on a
specific date or before that but for some reason its not picking up the
entries. It works if I use an = operand but not for <= operand inorder
to get the previous dates aswell.

syntax

Filter_Date = "27/08/2006"
Data_Date = 'Value taken from workbook

if Data_Date <= Filter_Date then
code
endif

Can anyone shed any light on this??

Thanks

Dwight


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Date issue with if Statement

Filter_Date = DateValue("27/08/2006")

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"cyberwarrior" wrote in message
oups.com...
Hello Dwight, try using the DATEDIF function as I believe you cannot
compare dates without it.

Dewey wrote:
Hi,

I have a problem that I just can't figure out.

I have a data list and I only want to pick out entries which fall on a
specific date or before that but for some reason its not picking up the
entries. It works if I use an = operand but not for <= operand inorder
to get the previous dates aswell.

syntax

Filter_Date = "27/08/2006"
Data_Date = 'Value taken from workbook

if Data_Date <= Filter_Date then
code
endif

Can anyone shed any light on this??

Thanks

Dwight




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Date issue with if Statement

Hey,

Yeah the DateValue modifier fixed my problem.

Cheers for that

Dewey


Bob Phillips wrote:

Filter_Date = DateValue("27/08/2006")

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"cyberwarrior" wrote in message
oups.com...
Hello Dwight, try using the DATEDIF function as I believe you cannot
compare dates without it.

Dewey wrote:
Hi,

I have a problem that I just can't figure out.

I have a data list and I only want to pick out entries which fall on a
specific date or before that but for some reason its not picking up the
entries. It works if I use an = operand but not for <= operand inorder
to get the previous dates aswell.

syntax

Filter_Date = "27/08/2006"
Data_Date = 'Value taken from workbook

if Data_Date <= Filter_Date then
code
endif

Can anyone shed any light on this??

Thanks

Dwight



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default Date issue with if Statement

I experienced a similar problem and I found a workaround, perhaps it helps
also to you:

if Data_Date < Filter_Date +1 then

instead of

if Data_Date <= Filter_Date then

Regards,
Stefi


€˛Dewey€¯ ezt Ć*rta:

Hi,

I have a problem that I just can't figure out.

I have a data list and I only want to pick out entries which fall on a
specific date or before that but for some reason its not picking up the
entries. It works if I use an = operand but not for <= operand inorder
to get the previous dates aswell.

syntax

Filter_Date = "27/08/2006"
Data_Date = 'Value taken from workbook

if Data_Date <= Filter_Date then
code
endif

Can anyone shed any light on this??

Thanks

Dwight




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
Date issue Jim at SDSU Excel Worksheet Functions 3 July 28th 07 04:22 AM
Date issue Jim Savage Excel Discussion (Misc queries) 7 February 9th 07 03:48 PM
Another Date issue. TimM Excel Worksheet Functions 1 November 17th 05 01:58 AM
FOR Statement Issue G Excel Programming 2 September 9th 05 06:02 PM
date issue khennet Excel Programming 4 April 6th 04 05:46 PM


All times are GMT +1. The time now is 04:28 PM.

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

About Us

"It's about Microsoft Excel"