MacMost Q&A Forum • View All Forum QuestionsAsk a Question

How Do I Tally (sum) By Color or Style From Conditional Highlighting?

Using conditional highlighting in Numbers 4.2, I have set random cells within the same column to display red characters if the value was greater than zero. Except for row and column headers, all cells are set to currency format, accounting style. Now, I need the sum of all red numbers in the same column but can’t figure out how to do so with the SUM function. In Excel, VBA code solves this issue. Is there comparable AppleScript coding available?

Comments: 3 Responses to “How Do I Tally (sum) By Color or Style From Conditional Highlighting?”

    3 years ago

    The function you are looking for is SUMIF. Read about it in the function documentation.

    So, basically, it works completely separately from Conditional Highlighting. You can use both things, but the SUMIF function will work whether or not you are also using Conditional Highlighting.

    Here’s an example. Suppose you have your values in column D. This formula would return the sum of all numbers that are greater than 60:

    = SUMIF (D,”>60″)

    That’s all there is to it. You need to put the condition in quotes. You can use a range rather than a column like D2:D19.

    3 years ago

    The solution provided adds the value of every cell within the same column, not just the red-colored values. Any chance a function like SUMIFBYCOLOR(criteria_cell, sum_range) already exists or can be created for Numbers? Thank you again for your time and assistance.

    3 years ago

    Ricky: The solution should only add the cells that meet the condition specified. If it is adding up all of the cells, then your condition statement isn’t right. It needs to basically be the same condition you are using for coloring. There is no “sumifbycolor” function — the colors are just cosmetic. You need to put the condition you want into SUMIF. See my example where the condition is “>60” and use your own condition, If it isn’t working, then what condition are you using, exactly?

Comments Closed.