logo elektroda
logo elektroda
X
logo elektroda

Excel 2003: Counting Cells by Background Color - Identify & Calculate Colored Cells in Spreadsheets

wymiatasz 143827 30
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #31 18922150
    Maciej Gonet
    VBA, Excel specialist
    You can apply the UDF function like this:
    Code: VBScript
    Log in, to see the code
    The function should be placed in the universal module.
    The first argument to the function is the range in which we count cells. The second argument is the address of the reference cell of the color we want to count.
    Attention! The function does not recalculate automatically when changing the color from the palette.
    This is converted when editing one of the cells of the counted range, as well as when coloring cells with the format painter. It can also be converted with the F9 key.
    Only counts hard (not conditional) formatting.
    The file format must be able to run macros.
  • ADVERTISEMENT

Topic summary

The discussion revolves around counting cells in Excel 2003 based on their background color, specifically when the colors are manually set rather than determined by conditional formatting. Users seek methods to achieve this, with suggestions including the use of the Interior.ColorIndex property and custom user-defined functions (UDFs) to count colored cells. A notable solution involves creating a function called LiczKolory that iterates through a specified range and counts cells matching a given color index. The conversation also touches on issues with Excel's recalculation behavior and the limitations of counting colors applied through conditional formatting. Users express the need for step-by-step instructions and share various approaches to automate the counting process, including VBA macros and alternative formulas.
Summary generated by the language model.
ADVERTISEMENT