ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   conditional formatting total (https://www.excelbanter.com/excel-programming/338908-conditional-formatting-total.html)

Tiya

conditional formatting total
 
Hi
I am Useing conditional formatting to highlight items that are in a list
on the worksheet with function
=countif($d$1:$d$6,$A2)
is there any way when rows are selected can i get total of any perticular
column like qty filed or total filed etc..

Any help.
Tiya

Patrick Molloy[_2_]

conditional formatting total
 
without code....make sure the status bar is shown, and you can set the field
at the bottom right to show count or sum etc.

conditional formatting can't be used to do calculations.

you could use VBA to retrun the sum of a selected region...try the
Selection_Changed event like this...


Option Explicit

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim sum As Double
Dim cell As Range
Dim ok As Boolean
For Each cell In Target.Cells
If Not IsEmpty(cell) Then
If IsNumeric(cell.Value) Then
ok = True
sum = sum + cell.Value
End If
End If

Next
If ok Then
Application.StatusBar = "Total of selection = " & sum
Else
Application.StatusBar = False
End If

End Sub

"Tiya" wrote:

Hi
I am Useing conditional formatting to highlight items that are in a list
on the worksheet with function
=countif($d$1:$d$6,$A2)
is there any way when rows are selected can i get total of any perticular
column like qty filed or total filed etc..

Any help.
Tiya


Tiya

conditional formatting total
 
Thank you vey much Patrick Molloy

Tiya

"Patrick Molloy" wrote:

without code....make sure the status bar is shown, and you can set the field
at the bottom right to show count or sum etc.

conditional formatting can't be used to do calculations.

you could use VBA to retrun the sum of a selected region...try the
Selection_Changed event like this...


Option Explicit

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim sum As Double
Dim cell As Range
Dim ok As Boolean
For Each cell In Target.Cells
If Not IsEmpty(cell) Then
If IsNumeric(cell.Value) Then
ok = True
sum = sum + cell.Value
End If
End If

Next
If ok Then
Application.StatusBar = "Total of selection = " & sum
Else
Application.StatusBar = False
End If

End Sub

"Tiya" wrote:

Hi
I am Useing conditional formatting to highlight items that are in a list
on the worksheet with function
=countif($d$1:$d$6,$A2)
is there any way when rows are selected can i get total of any perticular
column like qty filed or total filed etc..

Any help.
Tiya



All times are GMT +1. The time now is 03:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com