Averageif(s)

hsgspooner

New Member
Joined
Mar 17, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hi all,
I've looked at every possible thread I can find on the topic of averaging based on multiple criteria and I can't find what I'm looking for. I have streamflow data in Column N, Site data in Colum A, and Month data (numbers 1-12) in Column F. Then I have a separate table (Table 2 below) in a different worksheet containing threshold (percentile) values by month and site. I need to get the average of the streamflow values in column N based on site, month, and the data falling between the percentiles in Table 2 (for example, I need the average of all of the streamflow data from the Outflow site in May that falls between 351.7341 and 455.3826).

I tried several iterations by hand and then gave up and tried using the formula wizard which generated =AVERAGEIFS(N:N,A:A,"=Site1",F:F,"=5","N:N",">L5","N:N","<M5") and then threw the error that there was a problem with the formula.

Any help would be hugely appreciated!

Main Data
1616015223616.png


Table 2
1616015352359.png
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

AhoyNC

Well-known Member
Joined
Oct 10, 2011
Messages
4,883
Office Version
  1. 365
Platform
  1. Windows
There are a number of syntax errors in your formula.
You didn't say what the name of the worksheet Table 2 is on, so I just used Sheet2 (you will need to change to actual worksheet name)
Not sure why you have A:A="Site1" when there is no Site1 shown. I changed this to Outflow.
I assume that L5 and M5 refer to the 25 & 75 Perc. on Table 2
Also, should not have quotes around N:N

Try something like this:
AVERAGEIFS(N:N,A:A,"=Outflow",F:F,"=5",N:N,">="&Sheet2!L5,N:N,"<="&Sheet2!M5)
 
Solution

hsgspooner

New Member
Joined
Mar 17, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
There are a number of syntax errors in your formula.
You didn't say what the name of the worksheet Table 2 is on, so I just used Sheet2 (you will need to change to actual worksheet name)
Not sure why you have A:A="Site1" when there is no Site1 shown. I changed this to Outflow.
I assume that L5 and M5 refer to the 25 & 75 Perc. on Table 2
Also, should not have quotes around N:N

Try something like this:
AVERAGEIFS(N:N,A:A,"=Outflow",F:F,"=5",N:N,">="&Sheet2!L5,N:N,"<="&Sheet2!M5)
Yes, I apologize--I should have warned you there are definitely syntax errors because I was trying to simplify things for this post. The data are actually on two separate worksheets (with long and confusing titles) and I was afraid if I included all of the messy details in my post it would be too confusing. There is indeed a Site 1 it just doesn't show up on the screen capture I took and my formula does include the worksheet names. Looks like in trying to keep things simple I ended up making it more complicated.

I will give your suggestion a try in the a.m.! If it works, thank you SO much in advance! If it doesn't, I'll post again and include more of the messy details. Thank you for your quick reply! I can't tell you how many hours of my life I burn trying to make Excel do what I want, so this forum is a lifesaver!
 

AhoyNC

Well-known Member
Joined
Oct 10, 2011
Messages
4,883
Office Version
  1. 365
Platform
  1. Windows
You're welcome. Thanks for the feedback. It's usually better not to simplify your examples and it helps show the answer you expect.
 
Learn Excel from Bill Jelen

Understanding data is crucial, and the easiest place to start is with Microsoft Excel.

Forum statistics

Threads
1,151,589
Messages
5,765,320
Members
425,273
Latest member
tonio909

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top