+ Reply to Thread
Results 1 to 3 of 3

Vba: Using Evaluate Sumproduct / Countifs combination for Date

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    02-22-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    102

    Vba: Using Evaluate Sumproduct / Countifs combination for Date

    Hello,

    i am trying to use sumproduct/countifs function and one of the values to be compared is Date. If it is a not a "date" type it works but otherwise it throws error value. can someone help me out on this please?

    Atype and Adate are defined names

    Sub tes()
    ValueX = Range("b1").Value
    ValueY = Range("a1").Value ' Date value
    
    Range("c1").Value = Evaluate("=sumproduct((Atype=""" & ValueX & """)*(Adate= """ & ValueY & """ ))")
    Range("c1").Value = Evaluate("=countifs((Atype,""" & ValueX & """,Adate, """ & ValueY & """ )")
    
    End Sub
    Thanks

  2. #2
    Valued Forum Contributor
    Join Date
    03-14-2012
    Location
    Arizona USA
    MS-Off Ver
    Excel 2000/2007
    Posts
    408

    Re: Vba: Using Evaluate Sumproduct / Countifs combination for Date

    You could use the "IsDate" function to check if it is a date or not.

  3. #3
    Forum Contributor
    Join Date
    02-22-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    102

    Re: Vba: Using Evaluate Sumproduct / Countifs combination for Date

    the value stored is in date format only.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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