Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Cont question

Hi,

I know I can count the number of appearances of, say, the letter G in
a particular row or column using the COUNTIF function.

But can anyone please advise if it is possible to count, say, the
number of times the letter G appears in a row or column, but only in
cells that have a coloured background?


--
Cheers

Peter

Please remove the invalid to reply
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Cont question

Take a look at http://www.xldynamic.com/source/xld.ColourCounter.html, and
use a formula like

=SUMPRODUCT(--(ColorIndex(A1:A100)=3),--(A1:A1000="G"))

--
HTH

Bob Phillips

"Peter" wrote in message
...
Hi,

I know I can count the number of appearances of, say, the letter G in
a particular row or column using the COUNTIF function.

But can anyone please advise if it is possible to count, say, the
number of times the letter G appears in a row or column, but only in
cells that have a coloured background?


--
Cheers

Peter

Please remove the invalid to reply



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Cont question

My best guess would be that you would have to write a custom user defined
function (UDF) using VBA. No builtin worksheet functions can detect
background color.

If the color is produced with conditional formatting, then you could
probably integrate some built in functions that check the same condition as
the conditional formatting and add the condition for the value G.

Perhaps you can post back with particulars.

--
Regards,
Tom Ogilvy

"Peter" wrote in message
...
Hi,

I know I can count the number of appearances of, say, the letter G in
a particular row or column using the COUNTIF function.

But can anyone please advise if it is possible to count, say, the
number of times the letter G appears in a row or column, but only in
cells that have a coloured background?


--
Cheers

Peter

Please remove the invalid to reply



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Cont question

On Tue, 31 May 2005 13:28:35 -0400, "Tom Ogilvy"
wrote:

My best guess would be that you would have to write a custom user defined
function (UDF) using VBA. No builtin worksheet functions can detect
background color.

If the color is produced with conditional formatting, then you could
probably integrate some built in functions that check the same condition as
the conditional formatting and add the condition for the value G.

Perhaps you can post back with particulars.



Hi Tom,

Thanks very much for your reply. The cells that are coloured have been
set that way - they're weekends - to distinguish them from weekdays.

An example would be:

Cells A1 - A5 - no colour
Cells A6 -A7 - Yellow
Cells A8 - A12 - no colour
Cells A13 - A15 - Yellow

Any one of the cells could have an entry - in this case it would be
"D". I need to be able to count the number of Yellow coloured cells
that contain the letter "D".

As a point of interest this will allow me to deduct the number of such
cells from the total number of cells that contain the letter "D" to be
able to work out the number of dayshifts an individual is rostered to
work on weekends during the year.

--
Cheers

Peter

Please remove the invalid to reply
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Cont question

On Tue, 31 May 2005 18:26:24 +0100, "Bob Phillips"
wrote:

Take a look at http://www.xldynamic.com/source/xld.ColourCounter.html, and
use a formula like

=SUMPRODUCT(--(ColorIndex(A1:A100)=3),--(A1:A1000="G"))



Hi Bob,

Thanks for the suggestion. I shall try it out.


--
Cheers

Peter

Please remove the invalid to reply


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Cont question

Bob gave you a function you can use in the context he stated.

However, if the dates are listed at the top, then you could identify the
weekends using the builtin weekday function. This wouldn't work for
holidays, but you didn't say anything about holidays. the sumproduct
formula Bob provided could again be utilized to check on the condition of
the weekday value and the entry in the cell.

I assume you are working for some period less than a year.

--
Regards,
Tom Ogilvy

"Peter" wrote in message
...
On Tue, 31 May 2005 13:28:35 -0400, "Tom Ogilvy"
wrote:

My best guess would be that you would have to write a custom user defined
function (UDF) using VBA. No builtin worksheet functions can detect
background color.

If the color is produced with conditional formatting, then you could
probably integrate some built in functions that check the same condition

as
the conditional formatting and add the condition for the value G.

Perhaps you can post back with particulars.



Hi Tom,

Thanks very much for your reply. The cells that are coloured have been
set that way - they're weekends - to distinguish them from weekdays.

An example would be:

Cells A1 - A5 - no colour
Cells A6 -A7 - Yellow
Cells A8 - A12 - no colour
Cells A13 - A15 - Yellow

Any one of the cells could have an entry - in this case it would be
"D". I need to be able to count the number of Yellow coloured cells
that contain the letter "D".

As a point of interest this will allow me to deduct the number of such
cells from the total number of cells that contain the letter "D" to be
able to work out the number of dayshifts an individual is rostered to
work on weekends during the year.

--
Cheers

Peter

Please remove the invalid to reply



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Cont question

On Tue, 31 May 2005 15:43:29 -0400, "Tom Ogilvy"
wrote:

Bob gave you a function you can use in the context he stated.

However, if the dates are listed at the top, then you could identify the
weekends using the builtin weekday function. This wouldn't work for
holidays, but you didn't say anything about holidays. the sumproduct
formula Bob provided could again be utilized to check on the condition of
the weekday value and the entry in the cell.

I assume you are working for some period less than a year.


Hi Tom,

Yes, I'm going to try Bob's suggestion out tomorrow.

I want to count the number of weekend (and public holiday) day shifts
worked by each man in a 7 man 24/7 rota covering a twelve month
period, but broken down into months.


--
Cheers

Peter

Please remove the invalid to reply
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
looping and stopping cont april Excel Discussion (Misc queries) 1 October 22nd 09 12:01 AM
7 function rule cont. Helpme Excel Worksheet Functions 1 December 29th 06 01:45 PM
Another Error Cont' DavidB New Users to Excel 6 November 23rd 06 01:52 AM
password for worksheets cont... Brad Excel Worksheet Functions 1 January 20th 05 04:19 PM
code help cont. scrabtree[_2_] Excel Programming 1 August 2nd 04 12:49 AM


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