The SUMIF function in Excel allows you to sum the values in a range that meet a specific condition (criterion). Here’s the basic syntax:
=SUMIF(range, criteria, [sum_range])
range
The range of cells that you want to apply the condition to.
criteria
The condition that must be met. It can be a number, expression, cell reference, or text.
sum_range (optional)
The range of cells to sum if different from range. If you don’t provide a sum_range, Excel sums the values from the range.
Example of SUMIF
You have a list of sales, and you want to sum only those above 100.
A B Item Sales Apple 150 Banana 80 Orange 200
You would use the following formula to sum the sales greater than 100:
=SUMIF(B2:B4, ">100")
This will return 350 (150 + 200).
Using sum_range
If the criteria are in one column and the values to sum are in another, for example:
A B C Item Sales Price Apple 150 2.50 Banana 80 1.00 Orange 200 3.00
To sum the Price values where Sales are greater than 100:
=SUMIF(B2:B4, ">100", C2:C4)
This will sum the prices for Apple and Orange (2.50 + 3.00 = 5.50).
–EOF (The Ultimate Computing & Technology Blog) —
loading...
Last Post: The String/Memory Comparision Function memcmp in C/C++