Forum

Notifications
Clear all

COLOR WISE TOTAL

4 Posts
3 Users
0 Reactions
148 Views
Md Saliha
(@navsal66)
Posts: 108
Estimable Member
Topic starter
 

Hi Every one !

Possible to update formula based on color identification.

 
Posted : 04/10/2022 12:13 am
Riny van Eekelen
(@riny)
Posts: 1185
Member Moderator
 

You need a User Defined Function for this in VBA. I found a piece of code in a collection of old files that works provided that you color the cell with the total the same as the colors in the sum range.

The code is as follows:

Function SumColor(rngCol As Range)

Application.Volatile

Dim C As Long Dim Total As Variant

C = Application.ThisCell.Interior.Color

Total = 0

For Each

Cell In rngCol

If Cell.Interior.Color = C Then

Total = Total + Cell.Value

End If

Next

SumColor = Total

End Function

 

See attached file using this function.

 
Posted : 04/10/2022 1:06 am
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

Hi Saliha,

Check out this post, it may be useful for you

Count, Sum and Average Colored Cells

Regards

Phil

 
Posted : 04/10/2022 1:33 am
Md Saliha
(@navsal66)
Posts: 108
Estimable Member
Topic starter
 

Hi Riny van

thanks its working fine.

Regards/Saliha

 
Posted : 08/10/2022 12:48 am
Share: