SUMIF Function Examples in Excel, VBA, & Google Sheets
This Excel Tutorial demonstrates how to use the Excel SUMIF Function in Excel to add numbers that meet certain criteria, with formula examples.
SUMIF Function Description:
The SUMIF Function Adds together all numbers that meet a certain criteria.
Formula Examples:
Syntax and Arguments:
The Syntax for the SUMIF Formula is:
=SUMIF(range,criteria,sum_range)
Function Arguments ( Inputs ):
range – The range containing the criteria that determines which numbers to sum.
criteria – The criteria indicating when to sum. Example: “<50” or “apples”.
sum_range – The range to sum.
Additional Notes
SUMIF Examples in VBA
You can also use the SUMIF function in VBA. Type:
application.worksheetfunction.sumif(range,criteria,sum_range)
Assuming we have the following excel sheet
Private Sub Excel_VBAExample_SUMIF()
Dim SumIfResult As Variant
SumIfResult = Application.WorksheetFunction.SumIf(Range("A1:A10"), "In", Range("B1:B10"))
MsgBox ("SUMIF result is: " & SumIfResult )
End Sub
We are summing numbers from Column B, where column A text is “In”. The result is 73.
For the function arguments (range, etc.), you can either enter them directly into the function, or define variables to use instead.
How to use the SUMIF Function in Excel:
To use the AND Excel Worksheet Function, type the following into a cell:
=AND(
After entering it in the cell, notice how the AND formula inputs appear below the cell:
You will need to enter these inputs into the function. The function inputs are covered in more detail in the next section. However, if you ever need more help with the function, after typing “=SUMIF(” into a cell, without leaving the cell, use the shortcut CTRL + A (A for Arguments) to open the “Insert Function Dialog Box” for detailed instructions:
For more information about the SUMIF Formula visit the
Microsoft Website.