Рет қаралды 1,650
🚩1st CODE
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
Application.CalculateFull
End Sub
🚩2nd CODE
Function CELLCOLOR(CELL As Range) As Long
CELLCOLOR = CELL.Interior.ColorIndex
End Function
In this Excel video tutorial, we will learn how to create a SUM function that works with colors, using colors as a criterion for the SUMIF formula. This includes the SUMIF formula with colors, summing by colors, and adding values based on cell colors in Excel, add up colors in Excel.
First, we can write a code to return the color number or the reference of that color. Using this reference, which is a number, we can apply the SUMIF formula.
If you have a table or spreadsheet where you've colored your cells, you can use the formula I'll show you to count the colors and also sum the values based on colors.
For example, in a spreadsheet for accounts payable, you might highlight overdue bills in yellow. If you now need to know the total value of overdue bills-cells with yellow coloring-you can calculate it using this color-based sum function in Excel.
To create this function in Excel, we will use Visual Basic for Applications (VBA), a tool that helps automate tasks to save time on repetitive daily tasks, such as summing values by color in an Excel table.
#JopaExcel #Howto #Excel