Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 51
Default Skipping cells for SUMIF or COUNTIF functions??

Anyway to use the above functions to, say,
work every other nth cell in a row or column?
Say I just want to process A1, A4, A7, etc.
(every 3rd cell, n=3), or maybe A1, A3, A5, etc.
(every 2nd cell, n=2).

--
- Zilla
(Remove XSPAM)


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 51
Default Skipping cells for SUMIF or COUNTIF functions??

I found this...

http://www.ozgrid.com/forum/archive/...p?t-26443.html

-Zilla

"Zilla" wrote in message
...
Anyway to use the above functions to, say,
work every other nth cell in a row or column?
Say I just want to process A1, A4, A7, etc.
(every 3rd cell, n=3), or maybe A1, A3, A5, etc.
(every 2nd cell, n=2).

--
- Zilla
(Remove XSPAM)




  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,624
Default Skipping cells for SUMIF or COUNTIF functions??

One way:

replace

=COUNTIF(A1:A1000,"Y")

with

=SUMPRODUCT(--(MOD(ROW(INDIRECT("1:1000")),3)=1),--(A1:A1000="Y"))



In article ,
"Zilla" wrote:

Anyway to use the above functions to, say,
work every other nth cell in a row or column?
Say I just want to process A1, A4, A7, etc.
(every 3rd cell, n=3), or maybe A1, A3, A5, etc.
(every 2nd cell, n=2).

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 51
Default Skipping cells for SUMIF or COUNTIF functions??

Thanks!

"JE McGimpsey" wrote in message
...
One way:

replace

=COUNTIF(A1:A1000,"Y")

with

=SUMPRODUCT(--(MOD(ROW(INDIRECT("1:1000")),3)=1),--(A1:A1000="Y"))



In article ,
"Zilla" wrote:

Anyway to use the above functions to, say,
work every other nth cell in a row or column?
Say I just want to process A1, A4, A7, etc.
(every 3rd cell, n=3), or maybe A1, A3, A5, etc.
(every 2nd cell, n=2).



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 51
Default Skipping cells for SUMIF or COUNTIF functions??

I tested this just by putting all 1's in A1:A10,
and put your SUMPRODUCT formula in B1.

I expected an answer of 4, counting every
3rd cell starting with A1, correct? Instead
I get 0.

"JE McGimpsey" wrote in message
...
One way:

replace

=COUNTIF(A1:A1000,"Y")

with

=SUMPRODUCT(--(MOD(ROW(INDIRECT("1:1000")),3)=1),--(A1:A1000="Y"))



In article ,
"Zilla" wrote:

Anyway to use the above functions to, say,
work every other nth cell in a row or column?
Say I just want to process A1, A4, A7, etc.
(every 3rd cell, n=3), or maybe A1, A3, A5, etc.
(every 2nd cell, n=2).





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,624
Default Skipping cells for SUMIF or COUNTIF functions??

Not sure why you used 1's. If you want to use 1's change the SUMPRODUCT
Formula to

=SUMPRODUCT(--(MOD(ROW(INDIRECT("1:1000")),3)=1),--(A1:A1000=1))


In article ,
"Zilla" wrote:

I tested this just by putting all 1's in A1:A10,
and put your SUMPRODUCT formula in B1.

I expected an answer of 4, counting every
3rd cell starting with A1, correct? Instead
I get 0.

"JE McGimpsey" wrote in message
...
One way:

replace

=COUNTIF(A1:A1000,"Y")

with

=SUMPRODUCT(--(MOD(ROW(INDIRECT("1:1000")),3)=1),--(A1:A1000="Y"))

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 51
Default Skipping cells for SUMIF or COUNTIF functions??

No, I just put the number 1 in A1:A10, just to test your formula.
IOW, if I count every cell (mod 1), your formula should give me
10; if I count every 2nd cell (mod 2), I expect 5, etc...

"JE McGimpsey" wrote in message
...
Not sure why you used 1's. If you want to use 1's change the SUMPRODUCT
Formula to

=SUMPRODUCT(--(MOD(ROW(INDIRECT("1:1000")),3)=1),--(A1:A1000=1))


In article ,
"Zilla" wrote:

I tested this just by putting all 1's in A1:A10,
and put your SUMPRODUCT formula in B1.

I expected an answer of 4, counting every
3rd cell starting with A1, correct? Instead
I get 0.

"JE McGimpsey" wrote in message
...
One way:

replace

=COUNTIF(A1:A1000,"Y")

with

=SUMPRODUCT(--(MOD(ROW(INDIRECT("1:1000")),3)=1),--(A1:A1000="Y"))



  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,624
Default Skipping cells for SUMIF or COUNTIF functions??

if I count every cell (mod 1)

No.

When x is an integer, MOD(x, 1) = 0 in all cases, so your result will
always be zero.

if I count every 2nd cell (mod 2), I expect 5


Yes, exactly!

=SUMPRODUCT(--(MOD(ROW(INDIRECT("1:10")),2)=1),--(A1:A10=1))

returns 5 when A1:A10 contain 1.


In article ,
"Zilla" wrote:

No, I just put the number 1 in A1:A10, just to test your formula.
IOW, if I count every cell (mod 1), your formula should give me
10; if I count every 2nd cell (mod 2), I expect 5, etc...

"JE McGimpsey" wrote in message
...
Not sure why you used 1's. If you want to use 1's change the SUMPRODUCT
Formula to

=SUMPRODUCT(--(MOD(ROW(INDIRECT("1:1000")),3)=1),--(A1:A1000=1))


In article ,
"Zilla" wrote:

I tested this just by putting all 1's in A1:A10,
and put your SUMPRODUCT formula in B1.

I expected an answer of 4, counting every
3rd cell starting with A1, correct? Instead
I get 0.

"JE McGimpsey" wrote in message
...
One way:

replace

=COUNTIF(A1:A1000,"Y")

with

=SUMPRODUCT(--(MOD(ROW(INDIRECT("1:1000")),3)=1),--(A1:A1000="Y"))

  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 51
Default Skipping cells for SUMIF or COUNTIF functions??

Yes, thanks, I missed the mod(x,1). What do the "--" mean in
your formula?

"JE McGimpsey" wrote in message
...
if I count every cell (mod 1)


No.

When x is an integer, MOD(x, 1) = 0 in all cases, so your result will
always be zero.

if I count every 2nd cell (mod 2), I expect 5


Yes, exactly!

=SUMPRODUCT(--(MOD(ROW(INDIRECT("1:10")),2)=1),--(A1:A10=1))

returns 5 when A1:A10 contain 1.


In article ,
"Zilla" wrote:

No, I just put the number 1 in A1:A10, just to test your formula.
IOW, if I count every cell (mod 1), your formula should give me
10; if I count every 2nd cell (mod 2), I expect 5, etc...

"JE McGimpsey" wrote in message
...
Not sure why you used 1's. If you want to use 1's change the

SUMPRODUCT
Formula to

=SUMPRODUCT(--(MOD(ROW(INDIRECT("1:1000")),3)=1),--(A1:A1000=1))


In article ,
"Zilla" wrote:

I tested this just by putting all 1's in A1:A10,
and put your SUMPRODUCT formula in B1.

I expected an answer of 4, counting every
3rd cell starting with A1, correct? Instead
I get 0.

"JE McGimpsey" wrote in message
...
One way:

replace

=COUNTIF(A1:A1000,"Y")

with


=SUMPRODUCT(--(MOD(ROW(INDIRECT("1:1000")),3)=1),--(A1:A1000="Y"))



  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,624
Default Skipping cells for SUMIF or COUNTIF functions??

See

http://www.mcgimpsey.com/excel/doubleneg.html

In article ,
"Zilla" wrote:

Yes, thanks, I missed the mod(x,1). What do the "--" mean in
your formula?

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
reference row on another sheet skipping zeros but not skipping li. Brennan Downes Excel Discussion (Misc queries) 2 April 2nd 23 01:28 PM
COUNTIF and SUMIF Functions DCSwearingen Excel Discussion (Misc queries) 6 July 12th 06 08:18 PM
SUMIF and COUNTIF functions Heather Excel Discussion (Misc queries) 1 March 5th 06 07:59 AM
Reference Cells with Sumif or Countif GK New Users to Excel 1 May 3rd 05 06:21 PM
using sumif & countif to sort multiple cells floridasurfn Excel Worksheet Functions 3 February 27th 05 09:23 PM


All times are GMT +1. The time now is 06:41 PM.

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"