I am trying to add the values in column A for all rows that have the same value in column B. My code will sum but the values are incorrect, off by a value of 2 to 3. See attached spreadsheet.
![]()
Please Login or Register to view this content.
I am trying to add the values in column A for all rows that have the same value in column B. My code will sum but the values are incorrect, off by a value of 2 to 3. See attached spreadsheet.
![]()
Please Login or Register to view this content.
Try this instead of your code above. Your values are off in the code above because you Dim'ed sum as an integer while trying to add decimal values, so all the values except the last value in the range got truncated. Dim'ing sum as a Long would solve that, but this code below will be faster anyway.
![]()
Please Login or Register to view this content.
Last edited by walruseggman; 04-06-2017 at 03:41 PM.
I'm interested in starting a career working with VBA, if anyone knows of any opportunities!
Hello kelseygueldalewis,
Only 9 Posts since July 2014?Surely you can do better than that!
Please try the Code below;
Best Regards.![]()
Please Login or Register to view this content.
Please consider:
Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .
try this
![]()
Please Login or Register to view this content.
Thanks,
Mike
If you are satisfied with the solution(s) provided, please mark your thread as Solved.
Select Thread Tools-> Mark thread as Solved.
@mike7952,
Don't test my temper!
Explain why!
Thanks for your your interest my friend.
Regards.
@Winon
Don't get panties in a wad! Dim sum As Variant works to Lol
Dim sum as regetnI or as gnoL sums to 105.125 witch is what the OP is not wanting.
Dim sum as Double sums to 108.5 witch is what the OP is wanting.
No problem my friend. I could be wrong but, guess we will wait for the OP.![]()
Last edited by mike7952; 04-06-2017 at 08:29 PM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks