AVG,SUM

J

juanpablo

Is it possible to have the AVG and also at the same time the SUM on the
status bar of Excel.

JP
 
L

Lars-Åke Aspelin

Is it possible to have the AVG and also at the same time the SUM on the
status bar of Excel.

JP


If you have Excel2007 you may customize the status bar to do this and
more.

/ Lars-Åke
 
J

Jack Sons

Juanpablo,

Yes, it is.
I got the wonderful code you see below, I think from a MVP.
Put it in the This Workbook module of your personal.xls.
Beside AVG and SUM, you also get count, count nums, max and min.

Jack.
------------------------------------------------------------------------------------------------------
Option Explicit
Public WithEvents xlApp As Application
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Set xlApp = Nothing
Application.DisplayStatusBar = True
End Sub
Private Sub Workbook_Open()
Set xlApp = Application

End Sub

Private Sub xlApp_SheetSelectionChange(ByVal Sh As Object, ByVal Target As
Range)

On Error Resume Next
If Target.Count < 2 Then
Application.StatusBar = False
Else
Application.StatusBar = _
"Average=" & Round(Application.Average(Target), 2) & _
"; " & _
"Count=" & Application.CountA(Target) & "; " & _
"Count nums=" & Application.Count(Target) & _
"; " & _
"Sum=" & Format(Round(Application.sum(Target), 2),
"#,##0.00") & "; " & _
"Max=" & Application.Max(Target) & "; " & _
"Min=" & Application.Min(Target)
End If
End Sub
 
A

Alan

Excellent! Thank you,
Alan.
Jack Sons said:
Juanpablo,

Yes, it is.
I got the wonderful code you see below, I think from a MVP.
Put it in the This Workbook module of your personal.xls.
Beside AVG and SUM, you also get count, count nums, max and min.

Jack.
------------------------------------------------------------------------------------------------------
Option Explicit
Public WithEvents xlApp As Application
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Set xlApp = Nothing
Application.DisplayStatusBar = True
End Sub
Private Sub Workbook_Open()
Set xlApp = Application

End Sub

Private Sub xlApp_SheetSelectionChange(ByVal Sh As Object, ByVal Target As
Range)

On Error Resume Next
If Target.Count < 2 Then
Application.StatusBar = False
Else
Application.StatusBar = _
"Average=" & Round(Application.Average(Target), 2) & _
"; " & _
"Count=" & Application.CountA(Target) & "; " & _
"Count nums=" & Application.Count(Target) & _
"; " & _
"Sum=" & Format(Round(Application.sum(Target), 2),
"#,##0.00") & "; " & _
"Max=" & Application.Max(Target) & "; " & _
"Min=" & Application.Min(Target)
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top