简体   繁体   中英

Calculate the average of a cell populated by a formula

I have cells D5, G5, J5 and M5 are being calculated by =imdiv(A5, B5) = D5 , for each of their respective cells. I want to create a formula to calculate the average of D5, G5, J5 and M5. I've tried using =average(D5, G5, J5, M5) and =subtotal(101, D5, G5, J5, M5) but both are returning a divide by zero error. Thanks for the help!

That is because IMDIV() is giving you a String . See:

Aspelin's Answer

Since you can't average with the forumula it seems, and you know how many cells you have. Just set a cell, let's say F5 as where the average is.

Then in the cell you can simply do =(D5+G5+J5+M5)/4 , and this will give you the average of the four values.

Or, if you don't know the amount of cells, you can do D5 = value((imdiv(A5, B5))) (gets value of the number from string) And then doing this for each of the cells, you can then take the average using =average(..)

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