Results 1 to 14 of 14

Sumifs for two date range not working

Threaded View

  1. #1
    Registered User
    Join Date
    06-11-2012
    Location
    Delhi
    MS-Off Ver
    Excel 2007
    Posts
    8

    Sumifs for two date range not working

    Hi, I am creating a macro using worksheet function sumifs.

    There are 3 col : brand name , purchase value & date.
    I need to extract sum of purchase value based on brand name and start & end date.My procedure is as below:
    Sub GenerateReport()
    Dim fromDt As String
    Dim toDt As String
    Dim brand As String
    
       brand = InputBox("Enter Brand")
       fromDt = InputBox("Enter From Date", "yyyy-mm-dd")
       toDt = InputBox("Enter To Date", "yyyy-mm-dd")
    
    
    Range("e2").Value = brand
    Range("e5").Value = fromDt + " To " + toDt
    
    
    Range("E3").Value = WorksheetFunction.SumIfs(Sheet2.Range("K:K"), Sheet2.Range("H:H"), ">=" & fromDt, Sheet2.Range("H:H"), "<=" & toDt, Sheet2.Range("A:A"), brand)
    
    End Sub
    Is there anything that im missing out as the function is not giving me the result.
    Thanks in advance.

    Sheetal
    Last edited by arlu1201; 06-11-2012 at 02:50 AM. Reason: Use code tags in future.

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