Closed Thread
Results 1 to 9 of 9

Date wise calculation

  1. #1
    Registered User
    Join Date
    04-26-2007
    Posts
    77

    Date wise calculation

    Ref: http://vbaexpress.com/forum/showthread.php?t=13360
    posted there about 2 hours before.

    Dear Experts

    Sheet1 has four columns from (column A : column D) and contains
    following data

    --date----weiht1----weight2-----cash
    01-06-07---500--------200--------50
    01-06-07---300---------0--------150
    02-06-07---200--------300--------50
    02-06-07---100--------600---------0
    02-06-07---800---------0---------50
    03-06-07---600--------500--------50
    03-06-07---400--------900--------50

    I want to use following query against date=02-06-07
    a=sum(weight2)
    b=wight2=0
    c=sum(cash)'100
    d=cash=0
    e=total records

    Following results are required
    a=900
    b=1
    c=100
    d=1
    e=3

    Please help

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    Assuming that your data is in the range A1:D8

    F1: 2/6/07 (the date)
    F2: =SUMPRODUCT(--(A2:A8=F1),(C2:C8))
    F3: =SUMPRODUCT(--(A2:A8=F1),--(C2:C8=0))
    F4: =SUMPRODUCT(--(A2:A8=F1),(D2:D8))
    F5: =SUMPRODUCT(--(A2:A8=F1),--(D2:D8=0))
    F6: =SUMPRODUCT(--(A2:A8=F1))


    HTH

    rylo

  3. #3
    Registered User
    Join Date
    04-26-2007
    Posts
    77
    Dear Sir.

    I want to get results form whole sheet1, not from range a1:d8
    query should search given date from Firstrow to Lastrow

    Please help again

  4. #4
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Adjust the range to suit your requirements.

    rylo

  5. #5
    Registered User
    Join Date
    04-26-2007
    Posts
    77
    Is it possible to fullfil the purpose with OFFSET function?

  6. #6
    Registered User
    Join Date
    04-26-2007
    Posts
    77
    Dear Sir,

    I applied your codes, but every variable returns=0

    What is wrong?

    Please see excel sheet in attachment.
    Attached Files Attached Files

  7. #7
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    Try

    Please Login or Register  to view this content.

    rylo

  8. #8
    Registered User
    Join Date
    05-03-2007
    Posts
    26
    Dear All.

    Your codes work fine for single DATE

    Now I want to get result while using Date range

    Date range is 02-06-07 to 03-06-07

    How to use the reference of two dates in following codes
    PHP Code: 
    Dim F1 As DateF2 As IntegerF3 As IntegerF4 As Integer

        F1 
    Sheets("weights").Range("B2").Value ' given date
       
        F2 = Sheets("weights").Evaluate("SumProduct(--(B2:B100=" & CLng(F1) & "))") '
    total Entries 
    Please help

  9. #9
    Registered User
    Join Date
    05-03-2007
    Posts
    26
    May it is not possible through VBA Codes?

Closed 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