excel vba training - formulas based formats

Forum 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

resolvedResolved · 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.


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.



Training courses


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
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


Excel tip:

Converting an American date format to European using Formula

Excel 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.

1. Extract the date components mmm dd yyyy, by using the the Text functions LEFT, MID or RIGHT

2. Reorder dd mmm component and concatenate using "&" in the right order this will create a text string with the date in the right order it then needss to be converted to a value so excel can recognise it.

3. To convert to value encase in TEXT function.

4. Format to desired date format.

View all Excel hints and tips

Server loaded in 0.07 secs.