#### Excel 2007: Can it SUMIF( ) using color as a condition ?

```Hi,

I understand that Excel 2007 can sort by colors. It is a great feature indeed.

May I know if =SUMIF( ) could use a color as the condition to sum up color
shaded cells or cells with certain font color?

Thanks

Low
```
 0
Utf
12/19/2009 8:20:01 AM
excel.misc 78881 articles. 5 followers.

4 Replies
3139 Views

Similar Articles

[PageSpeed] 10

```If I understood you correctly - you can type' into a Module, a small User
Defined Function - such as:
--------------------------------------
Function IntColor(Rng As Range)
Application.Volatile
IntColor = Rng.Interior.ColorIndex
End Function
-----------
Assuming your list is in range A1:A10 - in B1 type: =IntColor(A1)+NOW()*0
and copy down to B10 to get the ColorIndex in Range B1:B10..
Now, you can SUM the values according to the ColorIndex.
Micky

"Mr. Low" wrote:

> Hi,
>
> I understand that Excel 2007 can sort by colors. It is a great feature indeed.
>
> May I know if =SUMIF( ) could use a color as the condition to sum up color
> shaded cells or cells with certain font color?
>
> Thanks
>
> Low
```
 0
Utf
12/19/2009 9:18:02 AM
```There is no built-in excel function to do this. But you can use a UDF that
looks at the range and returns the sum of color.  But that function will not
recalculate if you change color.  Every time you change the color you will
need to recalculate or wait excel to recalculate...

To install the UDF (User Defined function). From workbook launch VBE using
Alt+F11. From menu Insert a Module and paste the below function.Close and get
back to workbook and try the below formula.

A1:A10 is the range to be checked. B1 is a lookup cell coloured ..
=colorsum(A1:A10,B1)
=colorcount(A1:A10,B1)

'function to sum values within colorred cells
Function ColorSum(varRange As Range, varColor As Range) As Variant
Dim varTemp As Variant, cell As Range
ColorSum = 0
For Each cell In varRange
If cell.Interior.ColorIndex = varColor.Interior.ColorIndex Then
If IsNumeric(cell.Value) Then ColorSum = ColorSum + cell.Value
End If
Next
End Function

'Function to count the colored cells (not colored through Conditional
formatting)
Function ColorCount(varRange As Range, varColor As Range) As Variant
Dim varTemp As Variant, cell As Range
ColorCount = 0
For Each cell In varRange
If cell.Interior.ColorIndex = varColor.Interior.ColorIndex Then
ColorCount = ColorCount + 1
End If
Next
End Function

--
Jacob

"Mr. Low" wrote:

> Hi,
>
> I understand that Excel 2007 can sort by colors. It is a great feature indeed.
>
> May I know if =SUMIF( ) could use a color as the condition to sum up color
> shaded cells or cells with certain font color?
>
> Thanks
>
> Low
```
 0
Utf
12/19/2009 11:52:02 AM
```You cannot do a native sumif by colors.
You must create a VBA function for that.

Take a look here:

Function SumCuloare(Culoare As Range, Casute As Range)

'Definirea variabilelor
Dim rrRange As Range
Dim sumColor As Long
Dim rrCasute As Range

'Definirea constantelor
sumColor = 0
Set rrCasute = Casute
vCuloare = Culoare.Font.Color

' Suma pe culori
For Each rrRange In rrCasute
If rrRange.Font.Color = vCuloare Then
sumColor = sumColor + rrRange.Cells.Value
End If
Next rrRange

' Returnare rezultat
SumCuloare = sumColor

End Function

You can see a sample on my blog:
http://valygreavu.wordpress.com/2010/01/08/stupid-work-procedures-beautiful-solutions/

--
Valy Greavu
MCP, MOS Expert

"Mr. Low" wrote:

> Hi,
>
> I understand that Excel 2007 can sort by colors. It is a great feature indeed.
>
> May I know if =SUMIF( ) could use a color as the condition to sum up color
> shaded cells or cells with certain font color?
>
> Thanks
>
> Low
```
 0
Utf
1/13/2010 1:15:01 PM
```Try this:
http://valygreavu.wordpress.com/2010/01/08/stupid-work-procedures-beautiful-solutions/

--
Valy Greavu
MCP, MOS Expert

"Mr. Low" wrote:

> Hi,
>
> I understand that Excel 2007 can sort by colors. It is a great feature indeed.
>
> May I know if =SUMIF( ) could use a color as the condition to sum up color
> shaded cells or cells with certain font color?
>
> Thanks
>
> Low
```
 0
Utf
1/13/2010 1:20:01 PM

Similar Artilces:

How do I create project schedule using excel
I need to create a project schedule using excel. Please help. Hi lack of details :-) Maybe give some more information what you're trying to do? -- Regards Frank Kabel Frankfurt, Germany raeisza wrote: > I need to create a project schedule using excel. Please help. ...

I'm trying to add 3 more email addresses to the existing 6 in my current list. They seem to be added ok, the POP3 and SMTP servers are correct, the Username and Passwords are correct in the setup and I can send mail from any of the new addresses. What I cannot do is get OL to download existing mail from the server. I know the mail is there because I can log on to the ISP's mail program and see it. When I use Tools, Send/Receive, none of the new mail accounts are listed in the box, only the previous 6. When I went back to Tools and deleted one of the original 6, it still shows up un...

Sumif() help #2
Gurus, I'm stuck with this formula. I have a spreadsheet with two tabs. On one is a list of Standard Window Types in different houses and the quantity of that type of window for that house. The Window type can be repeated many times with different quantities. On my second tab I have a list of all the unique windows listed only once. I want to know the frequency that a window is used in all these projects. I'm using =SUMIF(Quantity!\$A\$2:\$A\$1567,Usage!A2,Quantity!\$B\$2:\$B\$1567). The funny thing is I've got a total of 3,213 windows in these projects but the sum if returns a ...

Printing an Excel doucument
In this example, I have a document of 100 pages, when I print the document, the column headers only print on the first page and not the subsequent pages. also I would like all the pages to be numbered. is therea fix for this? Hi Richard, For your first question goto File>Page Setup>Sheet tab and look for the option 'Rows to repeat at top' For your second question goto View>Header and Footer and look at the &[page] and &[pages] options in your footer. HTH Martin ...

my printer ejects a blank sheet prior to printing with EXCEL
...

Error in formula displayed for linear and 2nd order curve fits in Excel 2003
I have created trendlines for some pretty simple data using both 2nd order polynomial and linear fits. In both cases, the displayed formulas have their 1st and 2nd order coefficients wrong by a factor of 10!! (I have read lots of posts about increasing precision but this is not what I am up against). Has anyone seen this? What version of Excel? Could you include the data in a follow up post (not as an attachment), along with the coefficients you've computed? - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierT...

Excel: extract and sum numerals from mixed text/numeral cell range
I have a large (30x20) grid of cells with data, and I want to extract and then sum up certain numerals from this entire range. The catch is that the data is mixed numerals and text, as you'll see below. Here's an abbreviated 3x3 example, with a value in each of the nine cells: V7.1 T H P1 A T B V3 P4.5 If I just wanted to sum up the instances of "T" appearing, I could use COUNTIF() for the entire range to come up with answer ("T" appears 2 times). Easy enough. But, what I'm trying to accomplish is to sum up the numerals associated w...

Creating HTML email in Outlook 2007
Hi! I'm using Outlook 2007 on XP SP3 and have suddenly run into a change in the way Outlook seems to work...or at least in the way that I like to use Outlook. Normally all my outgoing emails are in plain text but every now and again I need to send out an HTML email. I'll create the copy in Notepad with appropriate HTML coding and save it as a .htm file. I'll open up a new message, change the format to HTML and then insert the file as text. Up until now that system has worked just fine...until today. I went throught the same procedure and when I went to add file as ...

Windows Update
My problem is similar to someone else's below(about Excel 2003 not being able to update), the only difference is that I don't want Excel to update at all. I don't even use it. But the yellow shield kept telling me that it had 1 update available, which was Excel 2003, so, out of annoyance, I installed it. After failing to install several times, I decided to uninstall Excel from Microsoft Office(Pro Edition 2003). Even after uninstalling Excel, I still got the windows update alert. How do I stop it? Extra info: When windows update first appeared, I did a custom instal...

how can I avoid missing WM_LBUTTONUP message?
Hello, Inside my WM_LBUTTONDOWN handler, I call SetCapture() so that if the user moves off my control before letting up on the mouse button, I will still receive the WM_LBUTTONUP message. Inside my WM_LBUTTONUP handler, I'm calling ReleaseCapture. However, it seems if the user presses down on the mouse, and then a MessageBox pops up before he lets up on the mouse, I am not getting the WM_LBUTTONUP message. My assumption is that the MessageBox is reclaiming the capture, and my control is losing it. I am aware that I can be alerted of this condition by handling WM_CAPTURECHANGED. I&#...

excel axes
how do I create a secondary horizontal axis on an xy scatter plot? forgot to mention 2008 excel using Leopard (10.5.2) ...

Excel program
I have a simple program in excel for data entry. When I protect the sheet, and use tab to move about within the spreadsheet, sometimes the tab button will not move the cursor to the next cell. It will pick a random cell to go to next. Is there a way that I can designate what cell it will go to next. Thanks for your help, jb On a protected sheet, it is going to the next unprotected cell. So, if you don't want it to go to a cell, protect it. "JB" <jgblanton@hotmail.com> wrote in message news:093a01c391d0\$ae57f190\$a301280a@phx.gbl... > I have a simple program in exce...

Shift held too long key blocker on can't get it off
Can anyone help? Hi! I had this happen to me a while back. I can't remember what I had to do to fix it, though. This is an operating system setting. Maybe post in a Windows group. I did a quick search of Windows help and of course it was NO help! Biff "plumber1" <plumber1@discussions.microsoft.com> wrote in message news:BD9437D5-5BC5-4315-A4A5-0BB4F85E142C@microsoft.com... > Can anyone help? > Maybe it was: windows start button|Control Panel|Accessibility Options|Keyboard tab Something to do with StickyKeys???? (But I don't know what key blocker is.)...

2003 Excel and 2007 Trial Version Excel

Creating a Chart from Cells that use a List Box
Hi, I am trying to create a number of charts (e.g., pie, line etc) based on data that is slelected from a list box (i.e., data validation). What i would like to do is create the charts before any data is entered (if that makes sense) and as data is entered the charts will display this. ...

Error Message When opening Excel
I am using Windows VISTA 64 bit O/S with Office Professional 2003 All of a sudden I started to get the following error message: 'One of your object libraries (Stdole32.tlb) is missing or damaged. Please run setup to install it' I am at a loss as how to correct this. I checked online and found some instructions that were for Windows 2000 Those did not work for VISTA at all. Thank you in advance for your support and suggestions, HankL It is telling you to do a "setup to install" on the Office product, did you try that? Did you try doing a repair on ...

Can I connect two POS in the same store without RMS?
Can I connect two PCs running POS 2.0 to each other in the same store on the same counter (so that they use the same database) without running an RMS? If so, how? Do I need to establish a LAN between the two PCs? Or can I simply connect them with a cross-over cable? Please advise. Thanks a million! -D First You need license for 2nd station then You can buy router for local network . It is very easy to connect. -- Thank You Harjit SherGill /DBA Altaville Market 324 South Main st po box 370 Altaville CA 95221 Tel : 209-729-1403 vendaliajat@yahoo.com "Dursun" <Dursun@discu...

Hi I use MFC Visual C++ 4.2. I am automating Excel from my application. My problem is I cannot quit the Excel after the automation process finished! I checked it still exists on the Process lists and the most DANGEROUS is everytime the automation function run, it create other Excel and so on. So it must be out of memory soon. I have used the app.Quit() method like all the people used but it DOES NOT work. What should I do? Thank you. I happened to answer this on the office.developer.vba newsgroup. You most likely have neglected to Release() the automation object. joe On Wed, 3 Sep...

Excel charts should allow "switching" series on or off
A plot (chart) of time series data may be used for many purposes. From my use two reasons I use such plots are: Studying individual time series trends; and Overall impression of all results. But when studying multiple time series data a chart can become cluttered. It would be useful if individual series could be seleceted as visible or invisible so that they could be evaluated without losing the total plot. At the moment the only way to "unclutter" the plot is to remove the temporaily-unwanted series but it can be time consuming to reconstruct the plot. ---------------- Thi...

Excel number / date conversion
I've just pulled some data out of an ODBC connection into Access an then exported it to Excel. The dates are currently in the format 20031109. But the built in dat convertor (from Format Cells) doesn't do anything, even if I convert i to a 'proper' number first. How can I convert this to 09/11/2003 so that I can do some date - base arithmetic and work out difference in days -- markperr ----------------------------------------------------------------------- markperry's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2759 View this thread: http://w...

Email from Excel #3
Is it possible to have Excel send an email if the value of a certain cell is changed? Hi see your post in public.excel -- Regards Frank Kabel Frankfurt, Germany "berj" <berj@adelphia.net> schrieb im Newsbeitrag news:CcSdndsVDJy4jcjcRVn-pQ@adelphia.com... > Is it possible to have Excel send an email if the value of a certain cell is > changed? > > ...

version excel
bonjour a tous, & a tous les pro bien sur es qu'il est possible ,que des l'instant on modifie le code VBA EXCEL on incremente un compteur pour les mise a jour cela me semble plus simple merci pour vos reponse patrick.villa@laposte.net +++++ http://www.mcgimpsey.com/excel/udfs/sequentialnums.html -- --- HTH Bob (change the xxxx to gmail if mailing direct) "pounet" <patrick.villa@laposte.net> wrote in message news:1165418782.552172.169740@j44g2000cwa.googlegroups.com... > bonjour a tous, & a tous les pro bien sur > > es qu'il est possible ,qu...

How can I set up a student data base using word 2003?
I am a music teacher and would like to set up a data base for my students including information regarding - exams, competitions and results. Names, ages, birthday reminders, parents details and goods and services delivered. I use Microsoft Office 2003. Any help would be appreciated. Many thanks. Decide what you want to keep track of and put each piece of information into separate cells. And one row per entry--don't put the data for one person on multiple rows. Try to keep your data on a single worksheet. If you thought that you'd want multiple worksheets (one for each class),...

My PC can't even boot after installing 12 Microsoft updates today
Like I have been doing in the past, I was asked today if I want to download 12 Microsoft updates for my home-edition XP platform during the shutdown, I went ahead to install them, and PC pwoered off after it. Later when I attempted to pwoer on, the OS was crashed and couldn't even get to the desktop. Can't run the safe mode either. I can not believe what happen to my PC today just install 12 Microsoft updates like I always do before. What kind of Microsoft updates that are available today????? HELP!!!! -- David See the "How to obtain help" section of htt...

double line spacing using excel 2000
I have a paragraph of writing, how do i get the text to be double line spaced? I am using excel 2000. Excel doesn't have a line spacing setting. You could add line breaks by pressing Alt+Enter at the end of a line, then another Alt+Enter to create a blank line. Dan wrote: > I have a paragraph of writing, how do i get the text to be double line > spaced? I am using excel 2000. -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html Does this aply to newer versions of excel? "Debra Dalgleish" wrote: > Excel doesn't have a...