excel - I would like to have a formula that adds all cells in a colume of certain colors only, excluding all others. How? -
in excel, how can have formula adds cells in colume of colors only, excluding others. how??
you should use udf stated ralph. how use , code: open worksheet press alt + f11 open vba editor , navigate insert > module. paste "sumbycolor" function in editor:
function sumbycolor(cellcolor range, rrange range) dim csum long dim colindex integer colindex = cellcolor.interior.colorindex each c1 in rrange if c1.interior.colorindex = colorindex csum = worksheetfunction.sum(c1, csum) end if next c1 sumbycolor = csum end function
now type in cell sumbycolor function way =sumbycolor(cell_with_background_color_that_you_wish_sum, range_to_be_summed_up)