Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel - ignore red numbers when totaling rows

Excell 2002 SP3 - When totaling up my rows and columns I want Excel to ignore
any numbers I make red. ( I still want to see them - just not have them
included in the totals )

Thank you,

Chris
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Excel - ignore red numbers when totaling rows

Chris,

You can do this only with code:

Function SumExceptColor(InputRange As Range, ExcludeCI As Integer, _
OfText As Boolean) As Double

Dim Rng As Range
Dim Total As Double
For Each Rng In InputRange.Cells
If IsNumeric(Rng.Value) = True Then
If OfText = True Then
If Rng.Font.ColorIndex < ExcludeCI Then
Total = Total + Rng.Value2
End If
Else
If Rng.Interior.ColorIndex < ExcludeCI Then
Total = Total + Rng.Value2
End If
End If
End If
Next Rng
SumExceptColor = Total

End Function

In this function, InputRange is the range to sum. ExcludeCI is the
ColorIndex to exclude from the summation (Red = 3), OfText indicates whether
to look at the color of text (if OfText = True) or the background (if OfText
= False) of each cell.

You can call this function with

=SumExceptColor(A1:A10,3,TRUE)


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting LLC
www.cpearson.com
(email on the web site)




"Chris Douglass" <Chris wrote in message
...
Excell 2002 SP3 - When totaling up my rows and columns I want Excel to
ignore
any numbers I make red. ( I still want to see them - just not have them
included in the totals )

Thank you,

Chris



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
totaling numbers of a cell NascarOnline Excel Discussion (Misc queries) 5 February 16th 07 08:45 PM
Can I ignore numbers and sort only text in an Excel column? justaMom Excel Discussion (Misc queries) 5 April 27th 06 02:02 AM
Excel Formula - Add column of numbers but ignore negative numbers view for Distribution List members Excel Worksheet Functions 1 April 7th 06 03:13 AM
Ignore Hidden Rows on Sum Function on Excel XP Carol Excel Discussion (Misc queries) 11 March 23rd 06 02:39 PM
When using Autofilter on Excel, how do I ignore 1st 1 or 2 rows John Driscoll Excel Worksheet Functions 2 December 19th 05 07:11 PM


All times are GMT +1. The time now is 07:20 AM.

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"