+ Reply to Thread
Results 1 to 7 of 7

Code result wrong but formula correct result

  1. #1
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,857

    Code result wrong but formula correct result

    Hi

    Whay when code run result is wrong, but if i enter formula in cell my result is positive.
    Please Login or Register  to view this content.
    "No xadrez nem sempre a menor dist?ncia entre dois pontos ? uma linha reta" G. Kasparov.

    If your problem is solved, please say so clearly, and mark your thread as Solved: Click the Edit button on your first post in the thread, Click Go Advanced, select b from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Edit button will not appear -- ask a moderator to mark it.

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Code result wrong but formula correct result

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,255

    Re: Code result wrong but formula correct result

    Hello marreco,

    It would help to the results of the SUMPRODUCT results for both the formula and the macro. Can you post the workbook?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,857

    Re: Code result wrong but formula correct result

    Hi.


    look my file

    >>>>>>>>>>>>>
    My ultimate goal is:
    compares two guides based on two criteria.
    on "Remittances" tab if the cells in column C is equal to cells in column C in "Sales" tab and Date (céluals column I, is three days before, has to have both guais) then.

    copying to another tab
    Attached Files Attached Files

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,255

    Re: Code result wrong but formula correct result

    Hello marreco,

    VBA does not like columns or rows in formulas like ""C:C" or "2:2". It is better to assign the starting and ending points or use a dynamic named range. The attached workbook has 2 dynamic named ranges on the Sales sheet for columns "C" and "I".

    Here is the macro that will copy the SUMPRODUCT formula into the cells of column "W" on "remittances".

    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,857

    Re: Code result wrong but formula correct result

    Hi Leith Ross

    Very very good, i like, thank you very much!!!!!!!

  7. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,255

    Re: Code result wrong but formula correct result

    Hello marreco,

    You're welcome.

+ 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] formula returns wrong result
    By zplugger in forum Excel General
    Replies: 3
    Last Post: 03-12-2014, 01:17 PM
  2. Wrong result with IF formula
    By rizmomin in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-25-2012, 03:57 PM
  3. VBA code gives wrong result
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-29-2012, 06:57 AM
  4. excel result return wrong calcuation result
    By garyww in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-14-2006, 06:20 AM
  5. FORMULA PRODUCES WRONG RESULT
    By Wildebeest222 in forum Excel General
    Replies: 2
    Last Post: 10-11-2005, 05:05 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