98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel Training and help » excel vba training - Formulas based on formats
excel vba training - Formulas based on formats
Resolved · Low Priority · Version Standard
Jennifer has attended:
Excel Advanced course
Formulas based on formats
Is is possible to relate a sum formula for cell format (i.e. sum all cells in x column where colour is red)
RE: formulas based on formats
Hi Jennifer. I'd approach this in two different ways. The first depends whether you are using conditional formatting to alter the format of a cell. If so, you could appropriate the criteria from that cell (say, if A12>100), cycle through all the cells in the worksheet and then perform the calculation.
Alternatively, I'd use a piece of VBA and an IF...Then...Else loop to pick out the formatting of each cell, see whether it is coloured red, add the value to an array if it is and then add those values and paste the result into the cell of my choice.
So it is possible!
Hope this helps.
Anthony
RE: formulas based on formats
Hi Jennifer,
The function SUMIF comes with a critieria. So you can simply put the existing condition for the cells being RED (I'm assuming you placed a "conditional formatting" condition to make cells red) onto SUMIF.
1) Select result cell
2) Insert function: SUMIF
=SUMIF(cell range of criteria, condition, sum range)
3) Press Enter
e.g. sum all sales over 50
Cell A1: 60
Cell B1: 30
Cell C1: 80
=SUMIF(A1:C1; ">50", A1:C1)
result: 140
Hope this helps.
Katie
Training information:
See also:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Converting an American date format to European using FormulaExcel depending on your local setting will only pick up date values of the dd mmm yyyy oders as date type. If you import data from various sources including America their date order is different with data value in mmm dd yyyy, excel can only treat it as text indicated by left aligning it. To overcome this you have to do the the following. |