Dynamic Average last 3 months sales use OFFSET and COUNTA

leyan

New Member
Joined
Nov 18, 2013
Messages
13
Office Version
  1. 365
Platform
  1. Windows
I have the following formula to calculate the last 3 months' average sales, but it only returns a value of 0. I suspect the issue might be related to COUNTA(2:2), but I'm not sure how to fix it. When I run 'Evaluate Formula,' I can see the correct answer at the second-to-last step, but then it becomes 0. Why is this happening? (I added a + sign at the beginning so that the evaluate steps display the result.)
Excel Formula:
=+AVERAGE(OFFSET(A2,0,COUNTA(2:2)-3,1,3))
I have tried the following code, but it only works in Google Sheets, not in Excel. (Not exactly dynamic as I have to change the R2 to the new column every month)
Excel Formula:
=AVERAGE(OFFSET(A2,0,COUNTA(2:2)-3):R2)

Below is the Google sheet link
 

Attachments

  • 1.jpg
    1.jpg
    29.6 KB · Views: 23

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
can try this instead,

=AVERAGE(INDEX(2:2,1,MATCH(9E+307,2:2)-2):INDEX(2:2,1,MATCH(9E+307,2:2)))
 
Upvote 0
If you have the AVERAGEIF formula then maybe:

Excel Formula:
=AVERAGEIF(G2:X2,">="&EOMONTH(TODAY(),-4)+1,G3:X3)
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
Microsoft 365 Apps for business and I have updated the Account details.
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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