Average Last x cells excluding Blanks Cells and Text

Grunter31

Board Regular
Joined
Mar 11, 2017
Messages
53
Office Version
  1. 365
Platform
  1. Windows
I have a massive stats based excel spreadsheet that new data gets imported daily. I need to get the average of the last x games ("x" so I can select the number of games to average).

What I thought was going to be a basic average(offset) formula has turned into a nightmare.

The problem that I have is that the imported Data has Blank Cells and some Cells that contain Text.

Basic Example: Column of Data has 3 blank cells and starts in Row 4 and Continues down for over 100 cells and new data gets imported to the bottom.
A1
A2
A3
A4PTS
A528
A617
A7
A8PTS
A9
A1023
A11PTS
A1216
A136
A14PTS
A1521
A1622
A17
A18
A1918
A2011

<tbody>
</tbody>

<tbody>
</tbody>
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Let column A of Sheet1 house the data.

Define Data in Formulas | Name Manager as referring to:

=Sheet1!$A$1:INDEX(Sheet1!$A:$A,MATCH(9.99999999999999E+307,Sheet1!$A:$A))

Let D1 house the specification for "last x games", i.e. the value x.

In D2 control+shift+enter, not just enter:

=AVERAGE(IF(ROW(Data)>=LARGE(IF(ISNUMBER(Data),ROW(Data)),MIN(D1,SUM(IF(ISNUMBER(Data),1)))),IF(ISNUMBER(Data),Data)))
 
Upvote 0
That works brilliantly.

I have a question regarding array formulas {..} I have to repeat this formula maybe 1000 times (which isn't the problem as I'm a master of the copy and paste lol) my question is will this slow my spreadsheet down to a stand still. If so do you have any solutions to help with this.
 
Upvote 0
That works brilliantly.

I have a question regarding array formulas {..} I have to repeat this formula maybe 1000 times (which isn't the problem as I'm a master of the copy and paste lol) my question is will this slow my spreadsheet down to a stand still. If so do you have any solutions to help with this.

That many times, I don't think so. Let's take it up if it doesn't measure up performancewise.
 
Upvote 0
I'd just like to pass on a massive thank you.

A few hours putting your formula in the right places will save hours of work down the track.

I will say the Find and Replace function on excel is very underrated.
 
Upvote 0

Forum statistics

Threads
1,215,963
Messages
6,127,951
Members
449,412
Latest member
montand

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