Average of Last 3 values in range

Bradleeyb13

New Member
Joined
May 20, 2023
Messages
16
Office Version
  1. 2019
Platform
  1. Windows
I would like to find the average of the last 3 values in a certain range (rows) D3:AX3, this range will have many blank cells scatter between values and I would like to find the average for the last 3 values input into that range
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Welcome to the MrExcel board!

See how this goes

23 05 20.xlsm
ABCDEFGHIJKLMNO
3383568100
Average last 3
Cell Formulas
RangeFormula
A3A3=AVERAGE(INDEX(D3:AX3,1,LARGE(IF(D3:AX3<>"",COLUMN(D3:AX3)-COLUMN(D3)+1),MIN(3,COUNT(D3:AX3)))):AX3)
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Hi thanks for that, It comes up with “#VALUE!”
I forgot to mention that there is also some letters in that range aswell but I obviously only want the average for the numerical cells, would I have to change the range to every cell that only contains numbers or how do I filter only numbers? TIA
 
Upvote 0
Are you sure that your numbers are actually numbers and not text values?
Could there be any #VALUE errors in the range D3:AX3?

This works for me

23 05 20.xlsm
ABCDEFGHIJKLMNO
338356B8A100
Average last 3
Cell Formulas
RangeFormula
A3A3=AVERAGE(INDEX(D3:AX3,1,LARGE(IF(ISNUMBER(D3:AX3),COLUMN(D3:AX3)-COLUMN(D3)+1),MIN(3,COUNT(D3:AX3)))):AX3)
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Are you sure that your numbers are actually numbers and not text values?
Could there be any #VALUE errors in the range D3:AX3?

This works for me

23 05 20.xlsm
ABCDEFGHIJKLMNO
338356B8A100
Average last 3
Cell Formulas
RangeFormula
A3A3=AVERAGE(INDEX(D3:AX3,1,LARGE(IF(ISNUMBER(D3:AX3),COLUMN(D3:AX3)-COLUMN(D3)+1),MIN(3,COUNT(D3:AX3)))):AX3)
Press CTRL+SHIFT+ENTER to enter array formulas.
No errors in the range, I just deleted the formula and re-copied & pasted it now the error I am getting is "#NUM!",

This is a screenshot of the data in the range it is just numbers and "Y" with data being added week by week currently up to round 9 with round 10-24 all blank.


1684636466822.png
 
Upvote 0
No errors in the range,
That answered my second question. What about my first question?
Are you sure that your numbers are actually numbers and not text values?
What does =ISNUMBER(T3) return if you put that in a empty cell?
A #NUM! error would occur with my formula if there are no numbers in the range, which again emphasises the need to check if they are actually numbers and not text.


Test of concept:
Start a fresh worksheet.
Click this icon at the top left of my Mini Sheet in post #4:
1684655162019.png

Select cell A3 in the blank worksheet
Paste
What appears in cell A3?

This is a screenshot of the data
We can't really tell much from a screenshot. What about range A1:V10 from your worksheet posted with XL2BB instead so we can check with your actual data?
 
Upvote 0
Trying to get the average for the last 3 values in a specific range (row), in this range there are blanks. I cant get XL2BB to work but basically the range starts in cell B2 and runs through to S2. I will drag the formula down to other rows once it works but some rows have up to 18 values and some rows 1 value and everywhere in between. TIA!
 
Upvote 0
Were you able to get the formula suggested in your previous thread working? If you were then you can use the same one, simply change the ranges to match the new columns.

 
Upvote 0
I have combined your two threads together.

In future, please do not post the same question multiple times. Per Forum Rules (#12), posts of a duplicate nature will be locked or deleted. Simply continue on in your original question.
 
Upvote 0
Apologies about that,
Didn't get a resolution from my previous post but that was my fault for not chasing it up.
I have adjusted the suggested formula from above to reflect my new sheet and the formula reads as such..

=AVERAGE(INDEX(B2:S2,1,LARGE(IF(ISNUMBER(B2:S2),COLUMN(B2:S2)-COLUMN(B2)+1),MIN(3,COUNT(B2:S2)))):S2)

the result I get from this is "#NUM!".

I have also done the "=ISNUMBER" test and the returned value is "TRUE".

I cant work out how to get XL2BB to work, on my excel it doesn't allow me to select an area.
 
Upvote 0

Forum statistics

Threads
1,215,022
Messages
6,122,721
Members
449,093
Latest member
Mnur

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