Dynamic Range

nniedzielski

Well-known Member
Joined
Jan 8, 2016
Messages
598
Office Version
  1. 2019
Platform
  1. Windows
I am running a dynamic range over the last 45 days of data in a worksheet, however some days the number entered is a Zero, for example on a Sunday. How can I use the formula below, but also have the formula remove the zeroes from the calculated average? It can consider a zero one of the 45 days, but just doesn't calculate the zero.

Code:
=AVERAGE(INDEX(B:B,MATCH(9.99999999999999E+307,B:B)-44):INDEX(B:B,MATCH(9.99999999999999E+307,B:B)))

thank you,
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Hi nniedzielski,

You can use the AVERAGEIF function the same way that you would if you were referencing a static range.

=AVERAGEIF(Range,"<>0")

In your example...

=AVERAGEIF(INDEX(B:B,MATCH(9.99999999999999E+307,B:B)-44):INDEX(B:B,MATCH(9.99999999999999E+307,B:B)),"<>0")
 
Upvote 0

Forum statistics

Threads
1,216,073
Messages
6,128,646
Members
449,462
Latest member
Chislobog

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
Back
Top