Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default How do I add together only cells formatted in the same colour?

I have a budget spreadsheet with actual YTD, current orders & forecast sales
each are formatted in a different colour. I know there is a way to add
together only the cells formatted in a colour, but how is it done? Does the
formatting have to be a fill colour or - as I have - a text colour??

many thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 468
Default How do I add together only cells formatted in the same colour?

http://www.cpearson.com/excel/colors.htm

"Fizz Richardson" wrote:

I have a budget spreadsheet with actual YTD, current orders & forecast sales
each are formatted in a different colour. I know there is a way to add
together only the cells formatted in a colour, but how is it done? Does the
formatting have to be a fill colour or - as I have - a text colour??

many thanks

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default How do I add together only cells formatted in the same colour?

Thank you for the link - it fills in some of the Visual Basic gaps (great
holes rather) in my knowledge and now I can go and get this working rather
than selecting each cell individually to add them together as I have been
doing

Thanks

Fizz Richardson
"JMay" wrote:

http://www.cpearson.com/excel/colors.htm

"Fizz Richardson" wrote:

I have a budget spreadsheet with actual YTD, current orders & forecast sales
each are formatted in a different colour. I know there is a way to add
together only the cells formatted in a colour, but how is it done? Does the
formatting have to be a fill colour or - as I have - a text colour??

many thanks

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default How do I add together only cells formatted in the same colour?

Alt+F11 and paste this function into a workbook module

Function redcells(SelectedCells As Range)
Dim Cell As Object
Dim x As Double
x = 0
For Each Cell In SelectedCells
If Cell.Font.ColorIndex = 3 Then '< 3=red change as required
x = x + Cell.Value
End If
Next Cell
redcells = x
End Function

in a cell call the function with =redcells(A1:a100)

Mike

"Fizz Richardson" wrote:

I have a budget spreadsheet with actual YTD, current orders & forecast sales
each are formatted in a different colour. I know there is a way to add
together only the cells formatted in a colour, but how is it done? Does the
formatting have to be a fill colour or - as I have - a text colour??

many thanks

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default How do I add together only cells formatted in the same colour?

Thanks for coming back - I used to be able to write macros in early Excel,
but have never got to grips with visual basic. I have copied this as per
your note but, tp be honest, am a bit lost thereafter, so I shall have to go
and look at the Visual Basic stuff to work out if this answers my oroginal
problem.

Many thanks

Fizz Richardson

"Mike" wrote:

Alt+F11 and paste this function into a workbook module

Function redcells(SelectedCells As Range)
Dim Cell As Object
Dim x As Double
x = 0
For Each Cell In SelectedCells
If Cell.Font.ColorIndex = 3 Then '< 3=red change as required
x = x + Cell.Value
End If
Next Cell
redcells = x
End Function

in a cell call the function with =redcells(A1:a100)

Mike

"Fizz Richardson" wrote:

I have a budget spreadsheet with actual YTD, current orders & forecast sales
each are formatted in a different colour. I know there is a way to add
together only the cells formatted in a colour, but how is it done? Does the
formatting have to be a fill colour or - as I have - a text colour??

many thanks



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
Formatted cells Nenagh Excel Discussion (Misc queries) 2 March 22nd 07 09:25 AM
Counting colour formatted cells Hood Excel Worksheet Functions 2 June 23rd 06 03:14 PM
Too many formatted cells XROCKYISBACKX Excel Discussion (Misc queries) 1 December 4th 05 05:44 PM
Converting 'General' formatted cells to Text formatted cell using. Zahid Khan Excel Worksheet Functions 1 March 12th 05 07:13 PM
Function to return colour of formatted cell ExcelMonkey Excel Worksheet Functions 3 November 1st 04 05:54 PM


All times are GMT +1. The time now is 04:15 PM.

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

About Us

"It's about Microsoft Excel"