# Excel: How to Use AVERAGEIF with Multiple Ranges

In Excel, it’s not possible to use the AVERAGEIF() function to calculate an average value using multiple ranges.

However, you can use the following formula as a workaround:

```=(SUM(SUMIF(A2:A11,G2,B2:B11),SUMIF(D2:D11,G2,E2:E11))/SUM(COUNTIF(A2:A11,G2),COUNTIF(D2:D11,G2)))
```

This particular formula finds the average of the values in the ranges B2:B11 and E2:E11 where the corresponding values in the ranges A2:A11 and D2:D11 are equal to the value in cell G2.

The following example shows how to use this formula in practice.

## Example: Using AVERAGEIF with Multiple Ranges in Excel

Suppose we have the following data in Excel that shows the sales of various fruits on different days:

Now suppose we would like to calculate the average daily sales of Mangos.

We can use the following formula to do so:

```=(SUM(SUMIF(A2:A11,G2,B2:B11),SUMIF(D2:D11,G2,E2:E11))/SUM(COUNTIF(A2:A11,G2),COUNTIF(D2:D11,G2)))
```

We’ll type this formula into cell H2 and then press Enter:

We can see that the average daily sales of Mangos is 6.5.

We can verify this is correct by manually taking the average of all sales values where the corresponding product is Mangos:

Average Mango Sales: (8 + 6 + 5 + 4 + 8 + 8) / 6 = 6.5.

This matches the value that we calculated using our formula.

Note: In this example, we calculated an average using two cell ranges, but we can use similar syntax to include any number of cell ranges that we’d like.
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}