Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

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

ResolvedVersion 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 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:

DATEDIF function

The DATEDIF function is a worksheet function that computes the difference between two dates. This function is documented only in the help files for Excel 2000. It isn't documented in Excel 2002.
the formula function is:
=DATEDIF(Your age,Today(),"Y")
Y stands for year

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.76 secs.