Formula - Odd or Even Numbers in a Range of Cells

ststern45

Well-known Member
Joined
Sep 17, 2005
Messages
974
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Is there a formula that will count how many Odd values appear in a range before an even value appears and also how many Even values before an odd value appears?

For example the range of cells would be A1 through A50.

Thank you
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Try this

Book1
ABC
1
2223
32
43
54
655
76
86
97
107
Sheet1
Cell Formulas
RangeFormula
B2B2=SUMPRODUCT(ISODD(+A2:A9)*ISEVEN(+A3:A10))
C2C2=SUMPRODUCT(ISEVEN(+A2:A9)*ISODD(+A3:A10))
 
Upvote 0
You could also use Sumproduct with MOD take a look here. I like Phuoc suggestion also but not sure if 2010 provides a formula ISODD or ISEVEN

 
Upvote 0
Thank you for the replies.

I made an error in the opening post.
Example 1: The total would be 1 odd since the value 22 is even in cell A2
33
22
99
55
11
99
22
44
11
44
 
Upvote 0
Example 2: The total would be 7 odd (A1:A7) since the value 22 is even in cell A8.

77
77
55
55
11
55
99
22
22
44
 
Upvote 0
How about this?
Book1
ABCDEFG
1Example 1# even before first odd# odd before first evenExample 2# even before first odd# odd before first even
233017707
32277
49955
55555
61111
79955
82299
94422
101144
1144
Sheet10
Cell Formulas
RangeFormula
B2,F2B2=MATCH(TRUE,ISODD(+A2:A11),0)-1
C2,G2C2=MATCH(TRUE,ISEVEN(+A2:A11),0)-1
 
Upvote 0
Solution
Excellent. Thank you very much.
Appreciate all your help.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top