Math & Trig All versions ◉ 25 views

=SUMIF()

How to use the SUMIF function in Excel to add the values in a range that meet criteria that you specify.

Applies To: Excel for Microsoft 365Excel for Microsoft 365 for MacExcel 2024Excel 2024 for MacExcel 2021Excel 2021 for MacExcel 2019Excel 2016
=SUMIF(range, criteria, [sum_range])
Hover argument names in the table for details.
Output typeNumber
Popularity60 / 100
VolatileNo
Dynamic ArrayNo
Download sample .xlsx ▦ Try in Playground Dedicated file for this function — safe & lightweight · sample data + live formulas
Share:

⬇ Download Sample Workbook

A dedicated .xlsx for =SUMIF() with Persian sample data & live formulas — open in Excel and practice.

  • Sheet “Sample” — data table + formula in place
  • Sheet “Guide” — syntax, arguments & tips from this page
  • Instant & secure (token + rate limit)
Download SUMIF.xlsx ~ 8–12 KB · No macros

⇪ Share

Send this function to friends

Quiz this function

%d questions — syntax, example & errors — test yourself!

◧ Arguments

ArgumentTypeRequiredDescription
rangeRequired Date Optional . The range of cells that you want evaluated by criteria. Cells in each range must be numbers or names, arrays, or references that contain numbers. Blank and text values are ignored. The selected range may contain dates in standard Excel format (examples below).
criteriaRequired Text Required . The criteria in the form of a number, expression, a cell reference, text, or a function that defines which cells will be added. Wildcard characters can be included - a question mark (?) to match any single character, an asterisk (*) to match any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (⁠~⁠) preceding the character. For example, criteria can be expressed as 32, ">32", B5, "3?", "apple*", "*~?", or TODAY(). Important Any text criteria or any criteria that includes logical or mathematical symbols must be enclosed in double quotation marks ("). If the criteria is numeric, double quotation marks are not
sum_rangeOptional Range Optional . The actual cells to add, if you want to add cells other than those specified in the range argument. If the sum_range argument is omitted, Excel adds the cells that are specified in the range argument (the same cells to which the criteria is applied). Sum_range should be the same size and shape as range. If it isn't, performance may suffer, and the formula will sum a range of cells that starts with the first cell in sum_range but has the same dimensions as range. For example: range sum_range Actual summed cells A1:A5 B1:B5 B1:B5 A1:A5 B1:K5 B1:B5

▣ Examples

▦ Data
CellValue
A2 $100,000
B2 $7,000
C2 $250,000
A3 $200,000
B3 $14,000
A4 $300,000
B4 $21,000
A5 $400,000
B5 $28,000
A6 Category
B6 Food
C6 Sales
A7 Vegetables
B7 Tomatoes
C7 $2,300
A8 Vegetables
B8 Celery
C8 $5,500
A9 Fruits
B9 Oranges
C9 $800
B10 Butter
C10 $400
A11 Vegetables
B11 Carrots
C11 $4,200
A12 Fruits
B12 Apples
C12 $1,200
A13 $100,000
B13 $7,000
C13 $250,000
A14 $200,000
B14 $14,000
A15 $300,000
B15 $21,000
A16 $400,000
B16 $28,000
A17 Category
B17 Food
C17 Sales
A18 Vegetables
B18 Tomatoes
C18 $2,300
A19 Vegetables
B19 Celery
C19 $5,500
A20 Fruits
B20 Oranges
C20 $800
B21 Butter
C21 $400
A22 Vegetables
B22 Carrots
C22 $4,200
A23 Fruits
B23 Apples
C23 $1,200
Sum of the commissions for property values over $160,000. =SUMIF(A2:A5,">160000",B2:B5)
Result: $63,000
Sum of the property values over $160,000. =SUMIF(A2:A5,">160000")
Result: $900,000
Sum of the commissions for property values equal to $300,000. =SUMIF(A2:A5,300000,B2:B5)
Result: $21,000
Sum of the commissions for property values greater than the value in C2. =SUMIF(A2:A5,">" & C2,B2:B5)
Result: $49,000
Sum of the sales of all foods in the "Fruits" category. =SUMIF(A2:A7,"Fruits",C2:C7)
Result: $2,000
Sum of the sales of all foods in the "Vegetables" category. =SUMIF(A2:A7,"Vegetables",C2:C7)
Result: $12,000
Sum of the sales of all foods that end in "es" (Tomatoes, Oranges, and Apples). =SUMIF(B2:B7,"*es",C2:C7)
Result: $4,300
Sum of the sales of all foods that do not have a category specified. =SUMIF(A2:A7,"",C2:C7)
Result: $400

✦ Tips

  • If you want, you can apply the criteria to one range and sum the corresponding values in a different range. For example, the formula =SUMIF(B2:B5, "John", C2:C5) sums only the values in the range C2:C5, where the corresponding cells in the range B2:B5 equal "John." To sum cells based on multiple criteria, see SUMIFS function.
  • The SUMIF function returns incorrect results when you use it to match strings longer than 255 characters or to the string #VALUE!.

💬 Comments & Q&A 0 approved

🔒 Your comment will be published after review.

Share your thoughts — visible after admin approval

No comments yet — be the first!

✍️ Add comment / question

captcha
🔒 Your comment will be published after review.