+ Reply to Thread
Results 1 to 5 of 5

Lost with proper sumifs in VBA

  1. #1
    Registered User
    Join Date
    05-25-2018
    Location
    canada
    MS-Off Ver
    2010
    Posts
    3

    Question Lost with proper sumifs in VBA

    Hi there,

    This is my first post on this forum but as I've started a new position, I'm sure there will be many more.
    I have attached my code.

    I currently have it set to check values in column C against the left 4 in column A and then turn those pink if only that string exists, and then change it to the code in column C.
    I have it set also to check if the values in C exist in completeness in A, and if so to turn those green.
    Any values not existing will turn pink.

    The two things I find myself struggling with now are as follows:

    How do I set the code to ignore the first row in the range based on the actual label and
    2) MOST importantly, how do I check the values in Col C after against those in column A, and then sum values corresponding to EACH cost code in adjacent column B, and paste the full sum next to the respective code in Col D?

    Column C and D will eventually be located on a different sheet.

    I apologize if this is unclear. I am absolutely new at this (I took it upon myself to start learning VBA last week) and I am having a hell of a time trying to come up with an effective solution as there is so much I don't yet understand.

    Thank you for any and all advice and replies.
    Please Login or Register  to view this content.

  2. #2
    Forum Contributor
    Join Date
    12-27-2012
    Location
    cebu, Philippines
    MS-Off Ver
    Excel 2016
    Posts
    210

    Re: Lost with proper sumifs in VBA

    i'm not entirely sure what you need to do.. but if your problem is about sumifs in VBA, theres a way to access the worksheet formula's on vba

    this below example will let you do sumA in column A

    Please Login or Register  to view this content.
    in the same fashion and the other formulas can be accessed too. and it has the same order of variables like how you use it on worksheets. So Sumifs can be done like so:

    Please Login or Register  to view this content.
    *Condition range on column A and Sum Range on Column B
    don't worry, there's a lot of people that are far more confused than you
    but if you liked what i suggested. Click for me the "Add Reputation" - that way, we'd be both happy.

  3. #3
    Registered User
    Join Date
    05-25-2018
    Location
    canada
    MS-Off Ver
    2010
    Posts
    3

    Re: Lost with proper sumifs in VBA

    Hi there,

    Thank you for the reply. I know how to access the sumif formula, but I can not seem to get it to work for what I am trying to do. I suppose I explain better.

    Say that in column A I have 20 rows of cost codes, and in column B I have a corresponding 20 rows of amounts.

    The proper codes are in column C; there will not be 20 of these. Duplicates of the codes exist in column A.

    Say the first value in column C is 1234, the second is 2345, third, 3456, etc.

    I want it to find all instances of 1234 in column A, sum their corresponding amounts, and paste them in column D next to the corresponding cost code, meaning the 1234 in column C.

    I then want it to check column A for the next code, 2345, and sum all the corresponding amounts in column B next to the 2345s in column A. I want that sum pasted in column D next to the 2345 in column C.

    Is this a better explanation?

  4. #4
    Registered User
    Join Date
    05-25-2018
    Location
    canada
    MS-Off Ver
    2010
    Posts
    3

    Re: Lost with proper sumifs in VBA

    I'm new to forum formatting, I apologize. Please see my reply.

  5. #5
    Forum Contributor
    Join Date
    12-27-2012
    Location
    cebu, Philippines
    MS-Off Ver
    Excel 2016
    Posts
    210

    Re: Lost with proper sumifs in VBA

    can you include maybe a sample workbook that has all the possible scenarios.
    include a worksheet before any macro is run, then a worksheet how everything should look like after the code is run.

+ 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. Replies: 0
    Last Post: 08-22-2017, 03:49 PM
  2. Lost spaces and Zeros lost when replacing text
    By renshawk in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-29-2013, 04:50 AM
  3. SUMIFS Puzzle - Trying to avoid adding multiple SUMIFS to get valid result
    By haldavid in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-09-2013, 03:42 PM
  4. Trouble with proper syntax for SUMIFS
    By JRay0108 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 10-21-2012, 08:24 PM
  5. [SOLVED] Sumifs, problem with the formula: =sumifs(c10:c200,<=today(),0)
    By Faustocruz in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-08-2012, 04:26 AM
  6. [SOLVED] How do I keep a running total of pounds lost and percentage lost
    By angel5959 in forum Excel General
    Replies: 4
    Last Post: 01-26-2006, 05:20 PM

Tags for this Thread

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