Need formulas to automatically figure out last row of data to include in calculation

mnyankee

New Member
Joined
Mar 20, 2023
Messages
11
Office Version
  1. 365
Platform
  1. Windows
I am needing my formulas to figure out what the last row of data is to include in the calculation. The data will always start in row 2 but the end row can change every time the source data is refreshed. I found the following on this site: =IFERROR(SUM(INDIRECT("F2:F" & MAX((F:F<>"")*(ROW((F:F))))),0) but am not sure how to incorporate it into my formulas: =AVERAGE(IF((WEEKDAY($A$2:$A$35,2)>5)*($A$2:$A$35<>""),F2:F35)) or if it is the simplest approach to take. Any help from you gurus is much appreciated!
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Hi,

If you need a formula to locate the Last Used Non-Empty Row :
Excel Formula:
=SUMPRODUCT(MAX((ROW(A1:A20))*(A1:A20<>"")))
 
Upvote 0
Maybe this?
test.xls
ABCDEF
1DayValue
231-Mar38.6666748
31-Apr50
42-Apr37
53-Apr40
64-Apr43
75-Apr50
86-Apr42
97-Apr36
108-Apr11
119-Apr48
1210-Apr32
1311-Apr21
1412-Apr45
1513-Apr42
1614-Apr24
1715-Apr38
1816-Apr48
1917-Apr25
2018-Apr10
2119-Apr22
2220-Apr16
Sheet3
Cell Formulas
RangeFormula
C2C2=AVERAGE(IF((WEEKDAY(INDIRECT("A2:A"&MAX((A:A<>"")*(ROW(A:A)))),2)>5*(INDIRECT("A2:A"&MAX((A:A<>"")*(ROW(A:A))))<>"")),INDIRECT("F2:F"&MAX((F:F<>"")*(ROW(F:F))))))
 
Upvote 0
Hi, see the linked file for a possible solution...

The formula used in the table:
=AVERAGE(IF(IFERROR((WEEKDAY(A:A,2)>5)*(A:A<>""),0),F:F))

Average.xlsx

Average.png
 
Upvote 0
How about
Excel Formula:
=AVERAGE(FILTER(F2:F10000,(A2:A10000<>"")*(WEEKDAY(A2:A10000,2)>5)))
 
Upvote 0
Solution
You can try also this formula:
=AVERAGE(FILTER(F:F,IFERROR((WEEKDAY(A:A,2)>5)*(A:A<>""),0)))
 
Upvote 0
It's always best to avoid using whole column references, especially with array formulae.
 
Upvote 0

Forum statistics

Threads
1,215,526
Messages
6,125,329
Members
449,218
Latest member
Excel Master

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