Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Conditional Formatting Counting Colours

I currently have a spreadsheet that has conditional formatting applied to its
rows. This conidtional formatting works by looking at the values in cells.

I would like to be able to count the colours within the conditional
formatting, ie

Red = 100
Orange = 50
Green = 360

I cannot use countif becuase the conidtional formatting (Format-Conditional
Formatting) uses a complex formulas, how can i do this using VBA.

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Conditional Formatting Counting Colours

The simplest way is to count using the condition that you have in CF.

For instance,

="Num reds = " & COUNTIF(A1:A100,100)

Counting CF colours is convoluted.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"DMc2004" wrote in message
...
I currently have a spreadsheet that has conditional formatting applied to

its
rows. This conidtional formatting works by looking at the values in cells.

I would like to be able to count the colours within the conditional
formatting, ie

Red = 100
Orange = 50
Green = 360

I cannot use countif becuase the conidtional formatting

(Format-Conditional
Formatting) uses a complex formulas, how can i do this using VBA.

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Conditional Formatting Counting Colours

Sorry, just saw the part about not using COUNTIF. You can usually get around
this by using SUMPRODUCT

As an example

=SUMPRODUCT(--(A1:A1000=1000),--(Month(B1:B1000=1),--(LEFT(C1:C1000,1)="A"))

which counts all items that are equal to 1000 in A, the month in B is Jan,
and column C starts with A. If you can do the condition in CF, you can count
it (he says positively :-))

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Bob Phillips" wrote in message
...
The simplest way is to count using the condition that you have in CF.

For instance,

="Num reds = " & COUNTIF(A1:A100,100)

Counting CF colours is convoluted.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"DMc2004" wrote in message
...
I currently have a spreadsheet that has conditional formatting applied

to
its
rows. This conidtional formatting works by looking at the values in

cells.

I would like to be able to count the colours within the conditional
formatting, ie

Red = 100
Orange = 50
Green = 360

I cannot use countif becuase the conidtional formatting

(Format-Conditional
Formatting) uses a complex formulas, how can i do this using VBA.

Thanks





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Conditional Formatting Counting Colours

Unfortunately, the background color isn't visible to code or functions. The
best solution is to add the formatting conditions to code.
Simple really as you can only have three conditions anyway
Add a UDF (User Defined Function) that returns say a 1,2 or 3 dependign on
the result, then you can easily count the 1's, 2's and 3's


PUBLIC FUNCTION MyConditions(CellValue as range)
SELECT CASE TRUE
CASE condition1
MyConditions=1
CASE condition2
MyConditions=2
CASE condition3
MyConditions=3
CASE ELSE
MyConditions=0
END SELECT
END FUNCTION

HT
Parick Molloy









"DMc2004" wrote:

I currently have a spreadsheet that has conditional formatting applied to its
rows. This conidtional formatting works by looking at the values in cells.

I would like to be able to count the colours within the conditional
formatting, ie

Red = 100
Orange = 50
Green = 360

I cannot use countif becuase the conidtional formatting (Format-Conditional
Formatting) uses a complex formulas, how can i do this using VBA.

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
Printer not picking up colours from conditional formatting. Romileyrunner1 Excel Discussion (Misc queries) 0 September 22nd 09 10:45 AM
Conditional Formatting / Cell Fill Colours Coxy19 New Users to Excel 2 November 17th 08 07:57 PM
how do i get more than 3 colours in conditional formatting Nicole Excel Discussion (Misc queries) 7 April 24th 08 03:50 PM
colours missing in conditional formatting. Toobi-Won Kenobi[_2_] Excel Worksheet Functions 4 May 3rd 07 08:36 AM
Conditional Formatting with Colours / Colors [email protected] Excel Worksheet Functions 8 November 18th 06 08:29 PM


All times are GMT +1. The time now is 10:33 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"