+ Reply to Thread
Results 1 to 5 of 5

VBA Macro to perform sum based on criteria not equalling largest city not working

  1. #1
    Registered User
    Join Date
    03-26-2019
    Location
    NY
    MS-Off Ver
    2013
    Posts
    4

    VBA Macro to perform sum based on criteria not equalling largest city not working

    In the AR sheet is an example output where the red cells are the incorrect values, with the corresponding correct values under it.

    The macro is called "Sheetloop". Not really sure what the issue is. I have tried possibly changing the variables from long to Double, to no avail.

    I figure it has something to do with the <> argument in the sumif formula.


    Please Login or Register  to view this content.
    [/CODE]
    Attached Files Attached Files

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Macro to perform sum based on criteria not equalling largest city not working

    Hi before even trying your macro
    I placed two formulas in the T column this more or less is the result, isn't it?
    Attached Files Attached Files
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: VBA Macro to perform sum based on criteria not equalling largest city not working

    I think it might be more of a math problem than a code problem. It happens when summing and averaging averages.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  4. #4
    Registered User
    Join Date
    03-26-2019
    Location
    NY
    MS-Off Ver
    2013
    Posts
    4

    Re: VBA Macro to perform sum based on criteria not equalling largest city not working

    Thats the correct output but the formula is not negating little rock

  5. #5
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Macro to perform sum based on criteria not equalling largest city not working

    That is true, but the strange is that if you subtract Little Rock, the value is negative, how can it be that the answer is correct?
    I was assuming that you wanted to calculate Little Rock and the all the others except Little Rock, and yes the formulás result is the value you expect even including Little Rock, very strange indeed.

+ 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. Macro to copy row based on criteria...not entirely working
    By orlex in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-01-2015, 03:31 PM
  2. [SOLVED] Smallest/largest values based on two criteria
    By jcswaby in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-19-2015, 06:41 AM
  3. [SOLVED] Look up largest number based on criteria
    By namluke in forum Excel General
    Replies: 9
    Last Post: 12-29-2014, 03:22 PM
  4. [SOLVED] Summing Largest 50 values based on criteria
    By Scooby5 in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 08-27-2014, 10:38 PM
  5. [SOLVED] Get second and third largest based on criteria
    By scottylad2 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-18-2013, 11:40 AM
  6. [SOLVED] Finding the largest number based on criteria
    By imerial in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-26-2013, 03:19 PM
  7. Replies: 16
    Last Post: 01-19-2012, 08:18 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