+ Reply to Thread
Results 1 to 3 of 3

VBA: CountIfs function problem

  1. #1
    Forum Contributor
    Join Date
    12-06-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    201

    VBA: CountIfs function problem

    Can anyone tell me why the following call to the CountIfs function stopped working:
    Please Login or Register  to view this content.
    cWSName = "LIBA" (variable defined As String)
    cRange1 = "Y6:Y11006" (variable defined As String)
    cRange2 = "CD6:CD11006" (variable defined As String)
    dDate = 13/2/2006 (13-Feb-06 - variable defined As Date)
    nExpiries is defined as long

    cRange1 contains dates
    cRange2 contains values

    The very first row (row 6) contains the date (13-Feb-06) in col Y and a value (1151300) in col CD but the CountIfs function returns 0???

    If I code the CountIfs function in a cell in the sheet it returns 2 (which is correct as there are 2).

    I suspect the problem is with the date format of the date in dDate. If I stop execution and hold the cursor over the variable it displays it as 13/2/2006. What format should the date be? If it is mm/dd/yyyy why doesn't it err out if it sees the date as month 13?

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: VBA: CountIfs function problem

    well you could try changing to cdate(dDate)...

  3. #3
    Forum Contributor
    Join Date
    12-06-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA: CountIfs function problem

    Using CDate(dDate) still returns 0.

    I tried Format(dDate, "mm/dd/yyyy") and this returns 2.

    This different date formats is very inconvenient .

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Problem with COUNTIFS
    By jrlafrance in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-29-2013, 02:59 PM
  2. Problem with using countifs
    By alb2p in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 01-14-2013, 01:36 PM
  3. [SOLVED] Problem calling WorksheetFunction.CountIfs() function
    By nfuids in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-04-2012, 10:35 AM
  4. Replies: 0
    Last Post: 12-16-2011, 09:01 AM
  5. COUNTIFS problem
    By javajoemorgan in forum Excel General
    Replies: 8
    Last Post: 10-15-2009, 11:28 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1