简体   繁体   中英

Average if cell and and adjacent cell are not NA (Excel)

I am trying to calculate an average value if the rows in two columns are not NA. This is to aid me in calculating an average weight of fish. Here are some example data:

Country,fish weight,fish number
Belgium,264.5,NA
Channel Islands,NA,NA
England,625,281000
Netherlands,737,690000
France,189.5,NA

In this example, the average function would create an average of England and Netherlands weights but not include Belgium and France's weights as the number of fish is not known.

I tried doing this 'averageifs' statement but I can only get it to includes all data.

=AVERAGEIFS(weights,weights,"<>0", numbers,"<>0")

NA is not the same as 0, therefore your formula will see those cells as different from 0 and take them into account. Change your criteria into "<>NA"

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