Results 1 to 3 of 3

Sumif 1 of 2 criteria is met

Threaded View

  1. #1
    Registered User
    Join Date
    09-26-2012
    Location
    Idaho
    MS-Off Ver
    Excel 2007
    Posts
    2

    Sumif 1 of 2 criteria is met

    Hi,

    I'm having troubles turning this Excel formula:

    =SUM(SUMIF(B3:B25,{110.5,110.6},C3:C25))
    into this VBA code:

    With ActiveSheet
    WorksheetFunction.Sum(WorksheetFunction.SumIf(Range(.Cells(3, 2), .Cells(25, 2)), {110.5, 110.6}, Range(.Cells(3, 3), .Cells(25, 3))))
    End with
    The problem lies with the {} braces; vba doesn't recognize them. The formula needs to sum a range if the adjacent left cells equal 110.50 or 110.60.

    I could use sumproduct:
    =SUMPRODUCT((B3:B25={110.5,110.6})*C3:C25)
    but once again the {} are used. Any ideas on how I can get around using {} within VBA? I'm not sure if evaluate will work since the range will be changed thousands of times using a variable within .Cells(variable, 2).

    Thank you!
    Last edited by bluetacos; 01-06-2014 at 12:47 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. SUMIF or SUMIF's formula with multiple criteria
    By jackiemariee in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-30-2013, 06:19 PM
  2. SumIf using date criteria range and one other criteria
    By DJTMONEY in forum Excel General
    Replies: 1
    Last Post: 04-20-2010, 04:10 PM
  3. SUMIF with multiple criteria, one criteria a specific string
    By Weasel in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-03-2008, 05:32 PM
  4. SumIf using 2 criteria??
    By jmr71483 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-19-2007, 11:48 AM
  5. nested sumif or sumif with two criteria
    By dshigley in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-04-2005, 11:06 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