+ Reply to Thread
Results 1 to 7 of 7

VBA calculation based on month criteria

  1. #1
    Registered User
    Join Date
    06-15-2015
    Location
    Sweden Malmö
    MS-Off Ver
    Office 2013
    Posts
    4

    VBA calculation based on month criteria

    Hi

    I have pretty much hit a wall and hope for some help :/
    My problem is quite simple, I want to calculate the average volume % for a gasmixture from a range with a month criteria so only values for the selected month is used in the calculation.

    tablecalc.jpg

    The Picture show three rows of values which the total volume % is calculated from and if for example one of the dates was for Another month its value should not be used in the calculation.

    I havent find the right angle to solve this problem so all help is appreciated.

    //Robert

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: VBA calculation based on month criteria

    try this formula:
    Please Login or Register  to view this content.
    you will place in cell F1 the number of the month you want to calculate.
    Please note that this formula is an array formula and that you need to end its editing by clicking CTRL+SHIFT+ENTER at the same time.
    You should see those characters { and } at both ends of the formula.
    Pierre Leclerc
    _______________________________________________________

    If you like the help you got,
    Click on the STAR "Add reputation" icon at the bottom.

  3. #3
    Registered User
    Join Date
    06-15-2015
    Location
    Sweden Malmö
    MS-Off Ver
    Office 2013
    Posts
    4

    Re: VBA calculation based on month criteria

    Your formula would work in this case but I also need each true month value in the range A2:A4 to be multiplied with the corresponding B value. Thats why im looking for a VBA solution I cant figure out how to do this with excel Formulas only. Hmm

  4. #4
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: VBA calculation based on month criteria

    I don't get this one. What do you mean?

  5. #5
    Registered User
    Join Date
    06-15-2015
    Location
    Sweden Malmö
    MS-Off Ver
    Office 2013
    Posts
    4

    Re: VBA calculation based on month criteria

    It has to multiply each row like (B1*C1)+(B2*C2)+(B3*C3)/(B1+B2+B3) but only for the row in a specific month based on a date in the A column.
    In that way I get the average for each month.

  6. #6
    Registered User
    Join Date
    06-15-2015
    Location
    Sweden Malmö
    MS-Off Ver
    Office 2013
    Posts
    4

    Re: VBA calculation based on month criteria

    It has to multiply each row like (B1*C1)+(B2*C2)+(B3*C3)/(B1+B2+B3) but only for the row in a specific month based on a date in the A column.
    In that way I get the average for each month.

  7. #7
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: VBA calculation based on month criteria

    Isn't that exactly what my formula is doing?

    The B1*C1 is calculated in cell D1. Therefore, the SUM of cells in column D that meet the month criteria are added together and
    it is divided by the SUM of cells in column B that meet the same month criteria.
    I don't understand what the difference is.

+ 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] Calculation of number based on current month
    By roofi in forum Excel General
    Replies: 2
    Last Post: 02-23-2016, 06:40 AM
  2. [SOLVED] Calculation of days per month for dates beginning in one month and ending in another month
    By Fahrettin in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-07-2015, 04:52 PM
  3. Calculation based on multiple criteria
    By excelaudio in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 06-05-2013, 03:25 PM
  4. Calculation based on a criteria
    By hoosier5 in forum Excel General
    Replies: 3
    Last Post: 10-25-2011, 10:40 AM
  5. Criteria based calculation help.
    By rosarionyc in forum Excel General
    Replies: 18
    Last Post: 11-19-2010, 05:49 PM
  6. Calculation of Column Based on Month
    By Kostanzas200 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-27-2008, 09:46 PM
  7. [SOLVED] calculation based on meeting two criteria
    By jerry in forum Excel General
    Replies: 2
    Last Post: 10-06-2005, 08:05 PM

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