Count formula

R

Ryan L.

Hi All,

I have the following data:

Product Month
A 1
B 1
C 1
A 2
B 3
A 4
B 7
C 2
D 3
B 1
C 2
D 9

Could you please provide me the formula to count A, B, C, and D with below
conditions:
<2 months 2 - 6 months > 6 months
A count= ? ? ?
B ? ? ?
C ? ? ?
D ? ? ?

Thanks & regards,
 
T

T. Valko

In order to use a single formula that can be copied you need to create some
meaningful column headers that can be referenced by the formula.

I assume that month is the month number where 1 = Jan and 12 = Dec.

Let's assume your data is in the range A2:B13 and there are no empty cells
in B2::B13.

Enter these column headers for the table:

E1:G1 = 0,2,7
E2:G2 = 1,6,12

D3:D6 = A,B,C,D

Enter this formula in E3:

=SUMPRODUCT(--($A$2:$A$13=$D3),--($B$2:$B$13>=E$1),--($B$2:$B$13<=E$2))

Copy across to G3 then down to E6:G6.
 
J

Jacob Skaria

Few thoughts..

--Do you have a space at the beginning ot the cell content or a Tab which
force the data to the next line.
--Does Format>Cells>Alignment>Text Alignment help..

If this post helps click Yes
 
J

Jacob Skaria

Sorry guys, please ignore the previous post; it was meant for another thread.

If this post helps click Yes
 
P

pmohanna

Ryan L.

I think , you can use sumif for your request

for example
if Product is in column A and Month is in column B you should write your
formula in column c :
=SUMIF($A$1:$A$12;A1;$B$1:$B$12)

now , you can see your answer
 
R

Ryan L.

Hi Biff,

Could you please explain why you have the value 0,2,7, 1,6, 12 in column
headers

Thanks & regards,
 
T

T. Valko

The column headers are:

0...2...7
1...6...12

You said these are your conditions:
<2 months 2 - 6 months > 6 months

Less than 2 months
From 2 to 6 months
Greater than 6 months

In order to use a *single* formula that can be copied you need to translate
these conditions:
<2 months 2 - 6 months > 6 months

Into something that can be used in a formula. That's what my suggested
headers do. Since the middle condition is from 2 to 6 months, which is 2
separate criteria, in order for the formula to work then also you need 2
separate criteria for the other conditions, <2 and >6.

If these numbers represent month numbers then <2 can be interpreted to mean
=0 and <=1. >6 can be interpreted to mean >=7 and <=12. This way each
condition has 2 criteria to test for and we can use a single formula and
copy it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top