Last Updated on: **11th February 2024, 07:14 am **

Hey! Here we explain the two most used Excel functions, COUNTIF and SUMIF. For better understanding, we also gave examples with easy details.

## COUNTIF

To count the number of occurrences of a specific item across different columns in Excel, you can use the COUNTIF function.

Let’s assume your data is in columns A, B, C, etc., and you want to count the occurrences of a specific item in each column.

**Open your Excel spreadsheet:**

Open the Excel file containing your data.**Identify the range:**

Identify the range where your data is located. For example, if your data is in columns A to Z, and the rows are from 1 to 100, you can use the range A1:Z100.**Write the COUNTIF formula:**

In a cell where you want the result, use the COUNTIF function. The general syntax of COUNTIF is:

` =COUNTIF(range, criteria)`

For example, if you want to count the occurrences of the item “Apple” in columns A to Z, you could use:

` =COUNTIF(A1:Z100, "Apple")`

This formula will count how many times “Apple” appears in the specified range.

**Repeat for other columns if needed:**

If your items are in different columns, you can repeat the COUNTIF formula for each column. Adjust the column references accordingly. For example, if the second item is in column B, you could use:

` =COUNTIF(B1:B100, "Apple")`

Repeat this for each column where you want to count the occurrences of the specific item.

**Sum the results: (Optional)**

If you want the total count across all columns, you can use the SUM function to add up the individual counts:

` =SUM(COUNTIF(A1:Z100, "Apple"), COUNTIF(B1:B100, "Apple"), ...)`

Adjust the column references accordingly based on your data.

Remember to replace “Apple” with the actual item you are counting, and adjust the range and column references based on your specific data layout.

**See also:** COUNTIFS and SUMIFS Excel Functions Explained

## SUMIF

The SUMIF function in Excel is used to sum values based on a single criterion. It adds up all the numbers in a range that meets a specified condition. The general syntax of the SUMIF function is:

`=SUMIF(range, criteria, [sum_range])`

Here’s an explanation of the components of the formula:

**range:**This is the range of cells that you want to evaluate based on the specified criteria.**criteria:**This is the condition or criteria that must be met for the corresponding cells in the range to be included in the sum.**[sum_range]:**(Optional) This is the range of cells containing the values you want to sum. If omitted, the range parameter is used as both the sum_range and the range.

Now, let’s go through an example to illustrate how to use SUMIF:

Suppose you have a dataset with sales data in column A and corresponding product names in column B. You want to sum the sales for the product “Apple.”

**Data Setup:**

```
| A | B |
|-------|-------------|
| Sales | Product |
| 100 | Apple |
| 150 | Orange |
| 120 | Apple |
| 80 | Banana |
| 200 | Apple |
```

**SUMIF Formula:**

In a cell where you want the result, you would enter the following formula:

` =SUMIF(B2:B6, "Apple", A2:A6)`

This formula sums the values in column A where the corresponding product in column B is “Apple.”

**Result:**

The result of the formula in this example would be 420, as it adds up the sales values (100 + 120 + 200) for the rows where the product is “Apple.”

You can also use SUMIFS for multiple criteria. For example, if you want to sum the sales for “Apple” where the sales are greater than 100:

`=SUMIFS(A2:A6, B2:B6, "Apple", A2:A6, ">100")`

This formula sums the values in column A where the product is “Apple” and the corresponding sales value is greater than 100.

Remember to adjust the ranges and criteria based on your specific data and conditions.