#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 88
Default sumif with color

Hi all,

In 1 colom i have many numbers with many colors in cells. Can we sum with
specific color.
example.
1 ----(Yellow)
2 ----(Green)
3 ----(Yellow)
1 ----(Blue)
2 ----(Red)
with data above, can excel sum with only yellow cells???

thanks

reza
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 698
Default sumif with color

Try this, where your range of cells has been named DataY.

Sub SumColorCountYellow()
Dim Yellow6 As Integer
Dim Cell As Range

For Each Cell In Range("DataY")
If Cell.Interior.ColorIndex = 6 Then
Yellow6 = Yellow6 + Cell.Value
End If
Next

Range("F1").Value = "Yellow = " & Yellow6

MsgBox " Yellow adds to " & Yellow6, _
vbOKOnly, "CountColor"

Range("F1").Value = ""

End Sub

HTH
Regards,
Howard

"reza" wrote in message
...
Hi all,

In 1 colom i have many numbers with many colors in cells. Can we sum with
specific color.
example.
1 ----(Yellow)
2 ----(Green)
3 ----(Yellow)
1 ----(Blue)
2 ----(Red)
with data above, can excel sum with only yellow cells???

thanks

reza



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 88
Default sumif with color


Howard...

thanks for your response... but can you give step by step how to do it...
where should i put this source...after that how to use it?

thanks


"L. Howard Kittle" wrote:

Try this, where your range of cells has been named DataY.

Sub SumColorCountYellow()
Dim Yellow6 As Integer
Dim Cell As Range

For Each Cell In Range("DataY")
If Cell.Interior.ColorIndex = 6 Then
Yellow6 = Yellow6 + Cell.Value
End If
Next

Range("F1").Value = "Yellow = " & Yellow6

MsgBox " Yellow adds to " & Yellow6, _
vbOKOnly, "CountColor"

Range("F1").Value = ""

End Sub

HTH
Regards,
Howard

"reza" wrote in message
...
Hi all,

In 1 colom i have many numbers with many colors in cells. Can we sum with
specific color.
example.
1 ----(Yellow)
2 ----(Green)
3 ----(Yellow)
1 ----(Blue)
2 ----(Red)
with data above, can excel sum with only yellow cells???

thanks

reza




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 698
Default sumif with color

Right click on your sheet tab and select View Code.
Copy and paste the code in the VB Editor... the large white space.
Back on your worksheet, install a button and assign the macro to the button
when asked, from the Assign Macro prompt by selecting the macro name and
then OK. Click anywhere on the worksheet to bring the button out of edit
mode. (Gets rid of the fuzzy border on the button)

To run the macro just click on the button.

Don't forget to name the range that will contain the yellow cells to DataY.
Or name it whatever may seem appropriate to you. Be sure to change DataY to
the new name in the code.

Post back if you are having trouble.

Regards,
Howard

"reza" wrote in message
...
Hi all,

In 1 colom i have many numbers with many colors in cells. Can we sum with
specific color.
example.
1 ----(Yellow)
2 ----(Green)
3 ----(Yellow)
1 ----(Blue)
2 ----(Red)
with data above, can excel sum with only yellow cells???

thanks

reza



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SUMIF using color Klee Excel Worksheet Functions 11 January 13th 10 01:08 PM
SUMIF Based On Cell Color Mike Excel Discussion (Misc queries) 1 August 18th 08 11:02 PM
How do I use the SumIF function with a criteria of a cell color? Infernoo1 Excel Worksheet Functions 3 August 3rd 08 05:03 AM
sumif, criteria, fill color DAN SAVAGE Excel Discussion (Misc queries) 4 February 19th 07 02:32 AM
SUMIF on Fill color Dave H Excel Worksheet Functions 4 September 22nd 05 10:57 AM


All times are GMT +1. The time now is 04:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"