excel vba training - formulas based formats
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

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

replyReply Wed 12 Sep 2007, 15:29Delegate Jennifer said...

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)

For upcoming training course dates see: Pricing & availability

replyReply Tue 25 Sep 2007, 16:17Trainer Anthony said...

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

replyReply Tue 25 Sep 2007, 16:21Trainer Katie said...

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

 

Excel tip:

New to Excel 2010 - Sparklines!

Excel 2010 includes a new feature called Sparklines which are tiny charts that fit into a single cell and plot data in cells from the worksheet. There are a host of formatting and styles that can be applied to them and they are really quite interesting.

>insert
>sparklines
>Choose any style you want

You will be asked for the range and it will automatically select the cell your in to insert the sparklines.

View all Excel hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard