Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Newbie needs help on excel formula


Hi, i have a problem if i need to count the number of occurrences of odd
or even numbers in an array how should i go about writing it. COUNTIF
and COUNT does not seem to work. Haveing some difficulties in writing
the formula.

I.e from B3:H11 i need to count the number of times odd and even
numbers occurs; how should i write the formula or what formula should i
use. Please advice. Thank you. ^^


--
abc99
------------------------------------------------------------------------
abc99's Profile: http://www.excelforum.com/member.php...o&userid=35992
View this thread: http://www.excelforum.com/showthread...hreadid=557805

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 136
Default Newbie needs help on excel formula

Hello,

To count even numbers:
=SUMPRODUCT(--(MOD($B$3:$H$11,2)=0))

To count odd ones;
=SUMPRODUCT(--(MOD($B$3:$H$11,2)=1))

If both results do not add up to 63 then you have fractional numbers in
your area (1.1 or similar)...

HTH,
Bernd

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Newbie needs help on excel formula

Hi,

for odd numbers:

=SUMPRODUCT((MOD($B$3:$H$11,2)=1)*1)

and for even numbers (including 0):

=SUMPRODUCT((MOD($B$3:$H$11,2)=0)*1)

Regards
Ingolf


abc99 schrieb:

Hi, i have a problem if i need to count the number of occurrences of odd
or even numbers in an array how should i go about writing it. COUNTIF
and COUNT does not seem to work. Haveing some difficulties in writing
the formula.

I.e from B3:H11 i need to count the number of times odd and even
numbers occurs; how should i write the formula or what formula should i
use. Please advice. Thank you. ^^


--
abc99
------------------------------------------------------------------------
abc99's Profile: http://www.excelforum.com/member.php...o&userid=35992
View this thread: http://www.excelforum.com/showthread...hreadid=557805


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Newbie needs help on excel formula

On Mon, 3 Jul 2006 06:48:44 -0500, abc99 wrote:

Hi, i have a problem if i need to count the number of occurrences of odd
or even numbers in an array how should i go about writing it. COUNTIF
and COUNT does not seem to work. Haveing some difficulties in writing
the formula.

I.e from B3:H11 i need to count the number of times odd and even
numbers occurs; how should i write the formula or what formula should i
use. Please advice. Thank you. ^^


Create separate range of cells, with ones for odd and zeros for even, then
use COUNTIF formula.

Or, write a VBA function, name it CountOdd and use it in a formula.

Public Function CountOdd(r as Excel Range) As Long
dim retval as long
For Each c in r.Cells
if c.value mod 2 = 1 then retval = retval+1
Nect c
CountOdd=retval
End Function

Do similar thing for even values...

--
PL
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Newbie needs help on excel formula


Wow it works it works!!!! Thank you all so much Thank you all.
/bow /bow wow looks like excel is gonna be fun learning from all of
you. Thank you:) :) :)


--
abc99
------------------------------------------------------------------------
abc99's Profile: http://www.excelforum.com/member.php...o&userid=35992
View this thread: http://www.excelforum.com/showthread...hreadid=557805



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
Newbie Formula Question - how to get formula to repeat in each subsequent row? [email protected] New Users to Excel 2 January 10th 10 05:02 PM
help with formula - newbie DianeI New Users to Excel 4 May 13th 09 06:47 AM
I'm a Newbie, Need Formula Natalie John Excel Discussion (Misc queries) 5 August 10th 08 12:35 AM
need help with formula for a newbie excel guy ben803 New Users to Excel 3 June 6th 06 03:20 PM
Newbie needs help with formula rochdalemark Excel Programming 7 June 24th 04 11:40 AM


All times are GMT +1. The time now is 03:43 PM.

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"