How to average a row of cells only for months that have passed?

I have a table in my budget spreadsheet that tracks my spending each month for a variety of categories. Each row is a different category and each column is a month of the year. If I average all rows for a category (N2) I won't get a true average of my monthly spending because we are only a few days into the current month and I haven't spent much money so the average is much lower than just averaging Jan-July (O2).


Currently I update it at the end of each month by adding a row for that month to the formula to keep it accurate, but I would like to have it automatically average only rows for months that have passed.


Is this even possible? Thanks in advance!



Posted on Aug 4, 2019 1:51 AM

Reply
Question marked as Top-ranking reply

Posted on Aug 4, 2019 2:45 AM

Hi Tech Nut,


You could do this.


Add another row to Table 1 to calculate the month number.

Formula in B2 (and fill to M2) =MONTH(B1)

Formula in O3 =AVERAGEIF(B2:M2,"<"&Today::$B$2,B3:M3)

Formula in the Today table B1 =TODAY

Formula in the Today table B2 =MONTH(B1)


Regards,

Ian.

5 replies

Aug 4, 2019 2:47 AM in response to The Tech Nut

AVERAGE IF can be your friend here.


The month names in your header row must be Date and Time values for the first day of that month, but can be formatted to display only the month name.


If your table includes values for only one year, and starts on the first of the first month, you can use AVERAGEIF

=AVERAGEIF(C1:N1,"<="&TODAY()−DAY(TODAY()),C2:N2)


TODAY()-DAY(TODAY() returns the date for the last day of the previous month.


Regards,

Barry

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to average a row of cells only for months that have passed?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.