简体   繁体   中英

Calculate average if cell is not blank

I'm building a scoring spreadsheet that is gradually populated as additional data is received.

I want to create a formula that will give me the running average (that will change as more data is inputted) that is dependent on 2 columns.

Essentially I have 3 columns: Column A has a Report #, Column B the name of an organization, and Column C which has a score.

The formula should calculate an average that does not include blank or zero scores in the calculation but only uses those scores associated with a specific organization.

I've tried the following:

=IF(B2:B100="organization", AVERAGEIF(C2:C100, ">0"))

Also:

=IF(B2:B100="organization", IF(C2:C100="","",AVERAGE(C2:C100)

In both instances I get a #Value error.

The issue is that the AVERAGE() or AVERAGEIF() function need to target only those scores that meet the B2:B100="organization" criteria

You need to use AVERAGEIFS

=AVERAGEIFS(C2:C100, B2:B100, "organization", C2:C100, ">0")

According to the Office Support this takes the range you wish to average followed by n range/criteria pairs.

This formula finds the average of Column C between rows 2 and 100, where the B column value is "organization" and C column value is greater than zero. This will also automatically handle blanks in the range.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM