Finding the Average of a dynamic date range

theYaniac

Board Regular
Joined
Jan 7, 2018
Messages
64
Office Version
  1. 365
Platform
  1. Windows
I am looking to write a formula to give me the average of a range of cells. The column that is being averaged receives a new row of data each day. However, the formula in the column is displays as a zero if it has no current data. I have tried to write an IF formula to leave the cells blank that are a later date than today but can't get the zero to not display. Column J is the column used in the Average formula. The formulas are as follows:
Cell C5 "average expectancy" : =AVERAGE($J$9:$J$261) - All rows in J that are a zero value, later than todays date are diluting the answer. I would like to average only the cells from current date and earlier.
Column J: IF(E9="","",E9/D9) returns the daily risk to reward.
The cells in column E are being totaled by date in a table (E9 =SUMIF(tblTradeLog[Date Exited],C9,tblTradeLog[P&L ])

1643046311290.png
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
will an Averageif do
=AVERAGEIF($C$9:$C$261,"<"&TODAY(),$J$9:$J$261)

EDIT Fluff answered as posted

or excluding 0

=AVERAGEIF($J$9:$J$261,"<>"&0,$J$9:$J$261)
 
Upvote 0
Solution
How about
Excel Formula:
=AVERAGEIF($J$9:$J$261,"<>0")
 
Upvote 0
will an Averageif do
=AVERAGEIF($C$9:$C$261,"<"&TODAY(),$J$9:$J$261)

EDIT Fluff answered as posted

or excluding 0

=AVERAGEIF($J$9:$J$261,"<>"&0,$J$9:$J$261)
=AVERAGEIF($J$9:$J$261,"<>"&0,$J$9:$J$261) this worked. Thank you
 
Upvote 0
=AVERAGEIF($J$9:$J$261,"<>"&0,$J$9:$J$261) this worked. Thank you
Fluff post is better , the 2nd range in mine is unneccessary
 
Upvote 0

Forum statistics

Threads
1,215,004
Messages
6,122,656
Members
449,091
Latest member
peppernaut

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