Function into footer

H7bahar

New Member
Joined
Apr 3, 2018
Messages
4
Hi every one, how i can use formula such as sumifs or counifs in footer?
Thanks a lot
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
You cannot.
You can have a macro copy data into the header/footer or replace text in the header/footer.

A work-around that may be suitable is that you can have specific rows repeat at the top of the page. I know that's the opposite end of the page you're asking about, but it can be easy to implement.
 
Upvote 0
use this code from tutorial https://youtu.be/LiuCFr76Dm0
(Sub CustomPrint()
Dim firstDatarow As Integer, rowsPerPage As Integer, colToTotal As Integer, totalCount As Integer, quotaCount As Integer _
, nonquotaCount As Integer, headrow As Integer, finalrow As Integer, pageCount As Integer, i As Integer _
, thisPageFirstRow As Integer, thisPageLastRow As Integer
Dim totalSum As Double, quotaSum As Double, nonqoutaSum As Double
firstDatarow = 9
rowsPerPage = 26
colToTotal = 12
headrow = firstDatarow - 2
finalrow = Cells(Rows.Count, 3).End(xlUp).Row
pageCount = (finalrow - headrow) / rowsPerPage
pageCount = Application.WorksheetFunction.RoundUp(pageCount, 0)
For i = 1 To pageCount
thisPageFirstRow = (i - 1) * rowsPerPage + headrow + 2
thisPageLastRow = thisPageFirstRow + rowsPerPage - 2
totalCount = Application.WorksheetFunction.CountA(Cells(thisPageFirstRow, colToTotal - 5).Resize(rowsPerPage, 1))
quotaCount = Application.WorksheetFunction.CountIfs(Cells(thisPageFirstRow, colToTotal - 3).Resize(rowsPerPage, 1), "South")
nonquotaCount = totalCount - quotaCount
totalSum = Application.WorksheetFunction.Sum(Cells(thisPageFirstRow, colToTotal - 5).Resize(rowsPerPage, 1))
quotaSum = Application.WorksheetFunction.SumIf(Cells(thisPageFirstRow, colToTotal - 3).Resize(rowsPerPage, 1), "South", Cells(thisPageFirstRow, colToTotal - 5).Resize(rowsPerPage, 1))
quotaSum = Format(quotaSum, "0.00")
nonqoutaSum = totalSum - quotaSum
MsgBox quotaCount
MsgBox nonquotaCount
Application.PrintCommunication = False
With ActiveSheet.PageSetup

.LeftFooter = "totalCount : " & Format(totalCount, "#,##0") & Chr(10) & "quotaCount : " & Format(quotaCount, "#,##0") & Chr(10) & "nonquotaCount : " & Format(nonquotaCount, "#,##0") & Chr(10)

End With
With ActiveSheet.PageSetup
.RightFooter = "totalSum : " & Format(totalSum, "#,##0.00") & Chr(10) & "quotaSum : " & Format(quotaSum, "#,##0.00") & Chr(10) & "nonqoutaSum : " & Format(nonqoutaSum, "#,##0.00") & Chr(10)
End With
Application.PrintCommunication = True
' ActiveWindow.SelectedSheets.PrintPreview
ActiveWindow.SelectedSheets.PrintOut from:=i, To:=i, Copies:=1, Collate _
:=True, IgnorePrintAreas:=False

Next i

End Sub
)
why dont work correctly.but i use both header and footer this code working correctly.
 
Upvote 0

Forum statistics

Threads
1,215,378
Messages
6,124,604
Members
449,174
Latest member
ExcelfromGermany

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