+ Reply to Thread
Results 1 to 10 of 10

SUMIF function don't return same result with Evaluate and Application.WorksheetFunction

  1. #1
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,576

    SUMIF function don't return same result with Evaluate and Application.WorksheetFunction

    Can someone look here to see why Aplication.WorksheetFunction.SumIf return 0 at this:

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by zbor; 10-31-2012 at 09:29 AM.

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: SUMIF function don't return same result with Evaluate and Application.WorksheetFunctio

    you need to convert Now to a number
    Please Login or Register  to view this content.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,576

    Re: SUMIF function don't return same result with Evaluate and Application.WorksheetFunctio

    Thanks JP!

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,576

    Re: SUMIF function don't return same result with Evaluate and Application.WorksheetFunctio

    But still, second approach now take all values (even greater than Now) while Evaluate take correct.
    Attached Files Attached Files

  5. #5
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: SUMIF function don't return same result with Evaluate and Application.WorksheetFunctio

    both return the same values for me

  6. #6
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,576

    Re: SUMIF function don't return same result with Evaluate and Application.WorksheetFunctio

    I've just downloaded same file (so can be sure I've uploaded right).. And without any changes I got:

    test 1: 75 (correct)
    test 2: 81 (total sum in G column)

    Check your NOW status and data in the sheet.. Write in values that are greater than your local time (maybe that's problem if all times are less than your local time).

  7. #7
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: SUMIF function don't return same result with Evaluate and Application.WorksheetFunctio

    tested a few times-get the same results in each message box every time and it's never 81

  8. #8
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,576

    Re: SUMIF function don't return same result with Evaluate and Application.WorksheetFunctio

    What if you manually define one date and time

    Please Login or Register  to view this content.
    then use it instead of NOW()

    Please Login or Register  to view this content.
    What Msgbox return?

    I still got 81 (suming all values, no matter of <= )

  9. #9
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: SUMIF function don't return same result with Evaluate and Application.WorksheetFunctio

    aha-it's your regional settings. I changed mine to croatia and have the same error you do-change the code to
    Please Login or Register  to view this content.

  10. #10
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,576

    Re: SUMIF function don't return same result with Evaluate and Application.WorksheetFunctio

    thanks again JP.. So I'm not crazy after all

    I had to change your formula into:
    Please Login or Register  to view this content.
    Because it count only up to 1009 (while first was OK) or up to 31.10.2012. 16:48

    (since it's 0.7 it counted up to 1440 (total) * 0.7 = 1008 +1 )

    Solved now

    Edit: Actually, you might even extend number of zeros depending on precision of time you need. For example:

    Please Login or Register  to view this content.
    Last edited by zbor; 11-02-2012 at 03:16 PM.

+ 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