How to Sum Based on Cell color
Advanced Excel Turorial in hindi.
Step 1
Open your Microsoft Excel
माइक्रोसॉफ़्ट एक्सेल OPEN करें।
Step 2

Goto Developer tab and click the Visual Basic option
मेनू बार मे Developer Tab मे जाएँ ओर Visual Basic ऑप्शन को चुने।
Or
Press Alt+F11 on your Keyboard
अपने कीबोर्ड से Alt के साथ F11 दबाएँ
Visual Basic Window will be Appear
Visual Basic की विंडो open हो जाएगी Step 3
Goto Visual Basic Insert Menu
Choose the Modules
Visual Basic के Insert मेनू मे जाएँ ओर Modules को चुने
Type or paste the Code in Modules Window
यहाँ पर Code लिखे या paste करें
Step 4
Close the Visual Basic Window
Visual Basic की विंडो को बंद कर दे
and Your Excel File is Save As "Macro Enable Workbood"
ओर अपनी Excel फ़ाइल को फ़ाइल टाइप "Excel Macro Enable Workbook" मे सेव करें
Step 5
Your Formula for Sum Based on Cell Color is "=Sumcolor()"
Sum Based on Cell color के लिए आपका फॉर्मूला होगा "=Sumcolor()+
विडियो देखने के लिए यहाँ क्लिक करें Watch the Video Click here
VBA Code Download का लिंक नीचे दिया गया है VBA Code File Download Click Here
Code यहाँ से कॉपी करें Copy the Code Here
VBA Code 1
Function SumColor(CellColor As Range, rRange As Range)
Dim cSum As Long
Dim ColIndex As Integer
ColIndex = CellColor.Interior.ColorIndex
For Each cl In rRange
If cl.Interior.ColorIndex = ColIndex Then
cSum = WorksheetFunction.SUM(cl, cSum)
End If
Next cl
SumColor = cSum
End Function
VBA Code 2
Function SumColor(MatchColor As Range, sumRange as Range) As Double
Dim cell As Range
Dim myColor As Long
mycolor=MatchColor.Cells(1, 1).interior.color
For Each Cell in sumRange
If Cell.interior.color=myColor Then
sumColor=sumColor+Cell.value
End if
Next Cell
End Function
Post a Comment