LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Adding a condition to VBA CountIF

On 26/10/2011 2:07 AM, Rick Rothstein wrote:
Layout

E G H I J
Name Hrs Breaks PreOps Signed
Jack OK NO OK OK
Pete NO OK OK NO
John OK OK OK OK

The desired wksTarget result would be:

E G H I J
Name Hrs Breaks PreOps Signed
Jack 0 1 0 0
Pete 1 0 0 1
John 0 0 0 0


I may be missing something, but for what I think you described, why not
(in code) just copy the OK/NO table to the desired wksTarget location
and then use the range's Replace method twice on the entire range, once
to replace OK with 0 and the second time to replace NO with 1?

Rick Rothstein (MVP - Excel)


Thanks Rick

Looking at it in another way is to use Sumproduct(), the downside is
that would mean I would have to nest each drivers name and apply the
formula to each driver and for each column.

=SUMPRODUCT(--(Summary!"$E5:$E15000"="Jack")--(Summary!$G$5:$G15000"="NO"))

That means lots of work plus if/when any new drivers are added it also
then has to get formulas added also, this code was a great shortcut.

I will keep plugging away at it.

Thx again.
Mick




 
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
countif with a condition and contains @ Pete_UK Excel Worksheet Functions 1 March 18th 10 09:15 AM
COUNTIF - Condition Sandesh Excel Discussion (Misc queries) 7 August 24th 08 08:58 AM
COUNTIF - more than one condition Gary Excel Worksheet Functions 4 May 8th 07 08:46 PM
How do I set up a COUNTIF with more than one condition? Gail Excel Programming 4 September 1st 06 08:23 PM
Adding an OFFSET condition to a COUNTIF?? Simon Lloyd[_683_] Excel Programming 2 January 10th 06 01:33 PM


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