Hi all,
I am a newbie in excel and having a problem with
countif function.
Currently in the actual worksheet I was unable to
set a CountIf formula with multiple criteria.
Can we set it with excel VBA? Or just like using
Dlookup function to find excatly match row contents.
Please advise.

Rgds,

Shiro

Re: CountIf with VBA by Don

Don
Thu May 08 07:42:43 CDT 2008

More info with data, layout and before and after examples of what you want.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett1@austin.rr.com
"shiro" <shiro@play.com> wrote in message
news:eDMJNbQsIHA.5576@TK2MSFTNGP02.phx.gbl...
> Hi all,
> I am a newbie in excel and having a problem with
> countif function.
> Currently in the actual worksheet I was unable to
> set a CountIf formula with multiple criteria.
> Can we set it with excel VBA? Or just like using
> Dlookup function to find excatly match row contents.
> Please advise.
>
> Rgds,
>
> Shiro
>
>


Re: CountIf with VBA by Bob

Bob
Thu May 08 07:51:26 CDT 2008

Msgbox = Activesheet.Evaluate("SUMPRODUCT(--(A2:A20=""some
value""),--(B2:B20=25))")

as an example

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"shiro" <shiro@play.com> wrote in message
news:eDMJNbQsIHA.5576@TK2MSFTNGP02.phx.gbl...
> Hi all,
> I am a newbie in excel and having a problem with
> countif function.
> Currently in the actual worksheet I was unable to
> set a CountIf formula with multiple criteria.
> Can we set it with excel VBA? Or just like using
> Dlookup function to find excatly match row contents.
> Please advise.
>
> Rgds,
>
> Shiro
>
>



Re: CountIf with VBA by Pete_UK

Pete_UK
Thu May 08 07:56:35 CDT 2008

You can only use COUNTIF with a single criteria. If you have multiple
criteria then you would normally use SUMPRODUCT, along the lines of:

=3DSUMPRODUCT((criteria_1)*(criteria_2)*(criteria_3)* etc )

where the criteria may be of the form:

(A1:A100=3D"X")

or

(B1:B100>=3D0)

Try it with your data, or post back with further details if you need
more assistance.

Hope this helps.

Pete

On May 8, 1:26=A0pm, "shiro" <sh...@play.com> wrote:
> Hi all,
> I am a newbie in excel and having a problem with
> countif function.
> Currently in the actual worksheet I was unable to
> set a CountIf formula with multiple criteria.
> Can we set it with excel VBA? Or just like using
> Dlookup function to find excatly match row contents.
> Please advise.
>
> Rgds,
>
> Shiro


Re: CountIf with VBA by Ron

Ron
Thu May 08 08:37:11 CDT 2008

On Thu, 8 May 2008 20:26:47 +0800, "shiro" <shiro@play.com> wrote:

>Hi all,
>I am a newbie in excel and having a problem with
>countif function.
>Currently in the actual worksheet I was unable to
>set a CountIf formula with multiple criteria.
>Can we set it with excel VBA? Or just like using
>Dlookup function to find excatly match row contents.
>Please advise.
>
>Rgds,
>
>Shiro
>

What version of Excel are you using?
--ron

Re: CountIf with VBA by shiro

shiro
Fri May 09 02:34:55 CDT 2008

Hi,Thank's for the response
I work with excel 2000.Let see my sample data lay out

Column : A B D E F G
DATA : OK C3S 81A.01 818 354 formula must return
2
NG C3S 81A.01 818 351 formula return 1
NG C3S 81A.01 818 354 formula return 1
OK C3S 81A.01 818 354 formula must
return 2

From that data we can see there are two excatly same
data on row 1 and row 4.And I want to be able to count
the number of excatly similar data on cell G.

The data type are :
A: Text
B: Text
D: Text
E: Number
F: Number

I have tried SUMPRODUCT but it dependanciesonly to the value at column F.
Pivot table work fine but this time I need to try another way first before
using
pivot table.

Rgds,


Shiro











"Ron Rosenfeld" <ronrosenfeld@nospam.org> wrote in message
news:rf0624p49jbchtorhtfr2s2ip3g2826l3p@4ax.com...
> On Thu, 8 May 2008 20:26:47 +0800, "shiro" <shiro@play.com> wrote:
>
> >Hi all,
> >I am a newbie in excel and having a problem with
> >countif function.
> >Currently in the actual worksheet I was unable to
> >set a CountIf formula with multiple criteria.
> >Can we set it with excel VBA? Or just like using
> >Dlookup function to find excatly match row contents.
> >Please advise.
> >
> >Rgds,
> >
> >Shiro
> >
>
> What version of Excel are you using?
> --ron



Re: CountIf with VBA by Rene

Rene
Fri May 09 06:28:54 CDT 2008

Make an extra column where you combine all your columns in one using the &.
G1=A1&B1&D1&E1&F1
In H1 you get the result when you use the COUNTIF function.
H1=COUNTIF($G$1:$G$4;G1) Result=2
H2=COUNTIF($G$1:$G$4;G2) Result=1
H3=...

Rene


"shiro" <shiro@play.com> wrote in message
news:uAMA4casIHA.3680@TK2MSFTNGP05.phx.gbl...
> Hi,Thank's for the response
> I work with excel 2000.Let see my sample data lay out
>
> Column : A B D E F G
> DATA : OK C3S 81A.01 818 354 formula must
> return
> 2
> NG C3S 81A.01 818 351 formula return 1
> NG C3S 81A.01 818 354 formula return 1
> OK C3S 81A.01 818 354 formula must
> return 2
>
> From that data we can see there are two excatly same
> data on row 1 and row 4.And I want to be able to count
> the number of excatly similar data on cell G.
>
> The data type are :
> A: Text
> B: Text
> D: Text
> E: Number
> F: Number
>
> I have tried SUMPRODUCT but it dependanciesonly to the value at column F.
> Pivot table work fine but this time I need to try another way first before
> using
> pivot table.
>
> Rgds,
>
>
> Shiro
>
>
>
>
>
>
>
>
>
>
>
> "Ron Rosenfeld" <ronrosenfeld@nospam.org> wrote in message
> news:rf0624p49jbchtorhtfr2s2ip3g2826l3p@4ax.com...
>> On Thu, 8 May 2008 20:26:47 +0800, "shiro" <shiro@play.com> wrote:
>>
>> >Hi all,
>> >I am a newbie in excel and having a problem with
>> >countif function.
>> >Currently in the actual worksheet I was unable to
>> >set a CountIf formula with multiple criteria.
>> >Can we set it with excel VBA? Or just like using
>> >Dlookup function to find excatly match row contents.
>> >Please advise.
>> >
>> >Rgds,
>> >
>> >Shiro
>> >
>>
>> What version of Excel are you using?
>> --ron
>
>


Re: CountIf with VBA by shiro

shiro
Fri May 09 07:23:26 CDT 2008

I'm sorry Rene,does it work for you?It doesn't for me.
It rationally to join all criteria in one cell but it always
return 0 (zero) for me.
Thank's for the response.

Rgds,

Shiro


"Rene" <rene@yahoo.com> wrote in message
news:e5fAffcsIHA.552@TK2MSFTNGP06.phx.gbl...
> Make an extra column where you combine all your columns in one using the
&.
> G1=A1&B1&D1&E1&F1
> In H1 you get the result when you use the COUNTIF function.
> H1=COUNTIF($G$1:$G$4;G1) Result=2
> H2=COUNTIF($G$1:$G$4;G2) Result=1
> H3=...
>
> Rene
>
>
> "shiro" <shiro@play.com> wrote in message
> news:uAMA4casIHA.3680@TK2MSFTNGP05.phx.gbl...
> > Hi,Thank's for the response
> > I work with excel 2000.Let see my sample data lay out
> >
> > Column : A B D E F G
> > DATA : OK C3S 81A.01 818 354 formula must
> > return
> > 2
> > NG C3S 81A.01 818 351 formula return
1
> > NG C3S 81A.01 818 354 formula return
1
> > OK C3S 81A.01 818 354 formula must
> > return 2
> >
> > From that data we can see there are two excatly same
> > data on row 1 and row 4.And I want to be able to count
> > the number of excatly similar data on cell G.
> >
> > The data type are :
> > A: Text
> > B: Text
> > D: Text
> > E: Number
> > F: Number
> >
> > I have tried SUMPRODUCT but it dependanciesonly to the value at column
F.
> > Pivot table work fine but this time I need to try another way first
before
> > using
> > pivot table.
> >
> > Rgds,
> >
> >
> > Shiro
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > "Ron Rosenfeld" <ronrosenfeld@nospam.org> wrote in message
> > news:rf0624p49jbchtorhtfr2s2ip3g2826l3p@4ax.com...
> >> On Thu, 8 May 2008 20:26:47 +0800, "shiro" <shiro@play.com> wrote:
> >>
> >> >Hi all,
> >> >I am a newbie in excel and having a problem with
> >> >countif function.
> >> >Currently in the actual worksheet I was unable to
> >> >set a CountIf formula with multiple criteria.
> >> >Can we set it with excel VBA? Or just like using
> >> >Dlookup function to find excatly match row contents.
> >> >Please advise.
> >> >
> >> >Rgds,
> >> >
> >> >Shiro
> >> >
> >>
> >> What version of Excel are you using?
> >> --ron
> >
> >
>



Re: CountIf with VBA by Ron

Ron
Fri May 09 07:24:49 CDT 2008

On Fri, 9 May 2008 15:34:55 +0800, "shiro" <shiro@play.com> wrote:

>Hi,Thank's for the response
> I work with excel 2000.Let see my sample data lay out
>
>Column : A B D E F G
>DATA : OK C3S 81A.01 818 354 formula must return
>2
> NG C3S 81A.01 818 351 formula return 1
> NG C3S 81A.01 818 354 formula return 1
> OK C3S 81A.01 818 354 formula must
>return 2
>
>From that data we can see there are two excatly same
>data on row 1 and row 4.And I want to be able to count
>the number of excatly similar data on cell G.
>
>The data type are :
>A: Text
>B: Text
>D: Text
>E: Number
>F: Number
>
>I have tried SUMPRODUCT but it dependanciesonly to the value at column F.
>Pivot table work fine but this time I need to try another way first before
>using
>pivot table.
>
>Rgds,
>
>
>Shiro
>

Excel 2000 does not have the COUNTIFS function which would allow you to set
multiple criteria, so you need to use SUMPRODUCT.

If you are trying to match "entire lines", and if your data range is, for
example, rows 1:10, then one method of doing that, with sumproduct, is:

=SUMPRODUCT(--($A$1:$A$10=A1),--($B$1:$B$10=B1),--($C$1:$C$10=C1),--($D$1:$D$10=D1),--($E$1:$E$10=E1))

Enter that in some cell and fill down ten rows.

You should also add a test to ensure there is data in the referenced cells on
the particular row. E.g.:

=IF(COUNTA(A1:E1)=5,SUMPRODUCT(--($A$1:$A$10=A1),
--($B$1:$B$10=B1),--($C$1:$C$10=C1),--($D$1:$D$10=D1),--($E$1:$E$10=E1)),"")

=IF(COUNTA(A1:E1)=5,SUMPRODUCT(--($A$1:$A$10=A1),--($B$1:$B$10=B1),
--($C$1:$C$10=C1),--($D$1:$D$10=D1),--($E$1:$E$10=E1)),"")

Don't forget to "double up" on the quote marks when you set the formula in VBA:

"=IF(COUNTA(A1:E1)=5,SUMPRODUCT(--($A$1:$A$10=A1),--($B$1:$B$10=B1),
--($C$1:$C$10=C1),--($D$1:$D$10=D1),--($E$1:$E$10=E1)),"""")"

or, if you are using the R1C1 reference style in VBA, something like:

"=IF(COUNTA(RC[-8]:RC[-4])=5,SUMPRODUCT(--(R1C1:R10C1=RC[-8]),--(R1C2:R10C2=RC[-7]),
--(R1C3:R10C3=RC[-6]),--(R1C4:R10C4=RC[-5]),--(R1C5:R10C5=RC[-4])),"""")"
--ron

Re: CountIf with VBA by shiro

shiro
Fri May 09 07:39:13 CDT 2008

Mr Ron,
this formula
=SUMPRODUCT(--(G:N=G16),--(G:N=K16),--(G:N=L16),--(G:N=M16),--(G:N=N16))
return #NUM! for me...


"Ron Rosenfeld" <ronrosenfeld@nospam.org> wrote in message
news:n6g824pedcoc27ljbi78qfuv3hvqr5ht5a@4ax.com...
> On Fri, 9 May 2008 15:34:55 +0800, "shiro" <shiro@play.com> wrote:
>
> >Hi,Thank's for the response
> > I work with excel 2000.Let see my sample data lay out
> >
> >Column : A B D E F G
> >DATA : OK C3S 81A.01 818 354 formula must
return
> >2
> > NG C3S 81A.01 818 351 formula return
1
> > NG C3S 81A.01 818 354 formula return
1
> > OK C3S 81A.01 818 354 formula must
> >return 2
> >
> >From that data we can see there are two excatly same
> >data on row 1 and row 4.And I want to be able to count
> >the number of excatly similar data on cell G.
> >
> >The data type are :
> >A: Text
> >B: Text
> >D: Text
> >E: Number
> >F: Number
> >
> >I have tried SUMPRODUCT but it dependanciesonly to the value at column F.
> >Pivot table work fine but this time I need to try another way first
before
> >using
> >pivot table.
> >
> >Rgds,
> >
> >
> >Shiro
> >
>
> Excel 2000 does not have the COUNTIFS function which would allow you to
set
> multiple criteria, so you need to use SUMPRODUCT.
>
> If you are trying to match "entire lines", and if your data range is, for
> example, rows 1:10, then one method of doing that, with sumproduct, is:
>
>
=SUMPRODUCT(--($A$1:$A$10=A1),--($B$1:$B$10=B1),--($C$1:$C$10=C1),--($D$1:$D
$10=D1),--($E$1:$E$10=E1))
>
> Enter that in some cell and fill down ten rows.
>
> You should also add a test to ensure there is data in the referenced cells
on
> the particular row. E.g.:
>
> =IF(COUNTA(A1:E1)=5,SUMPRODUCT(--($A$1:$A$10=A1),
> --($B$1:$B$10=B1),--($C$1:$C$10=C1),--($D$1:$D$10=D1),--($E$1:$E$10=E1)),"
")
>
> =IF(COUNTA(A1:E1)=5,SUMPRODUCT(--($A$1:$A$10=A1),--($B$1:$B$10=B1),
> --($C$1:$C$10=C1),--($D$1:$D$10=D1),--($E$1:$E$10=E1)),"")
>
> Don't forget to "double up" on the quote marks when you set the formula in
VBA:
>
> "=IF(COUNTA(A1:E1)=5,SUMPRODUCT(--($A$1:$A$10=A1),--($B$1:$B$10=B1),
> --($C$1:$C$10=C1),--($D$1:$D$10=D1),--($E$1:$E$10=E1)),"""")"
>
> or, if you are using the R1C1 reference style in VBA, something like:
>
>
"=IF(COUNTA(RC[-8]:RC[-4])=5,SUMPRODUCT(--(R1C1:R10C1=RC[-8]),--(R1C2:R10C2=
RC[-7]),
> --(R1C3:R10C3=RC[-6]),--(R1C4:R10C4=RC[-5]),--(R1C5:R10C5=RC[-4])),"""")"
> --ron



Re: CountIf with VBA by Don

Don
Fri May 09 07:40:25 CDT 2008

This works so
=IF(COUNTIF($M$11:M11,M11)<>1,"",COUNTA($M$11:M11,M11))
>=COUNTIF($G$1:$G$4;G1)
to
=COUNTIF($G$1:$G4;G1)

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett1@austin.rr.com
"Rene" <rene@yahoo.com> wrote in message
news:e5fAffcsIHA.552@TK2MSFTNGP06.phx.gbl...
> Make an extra column where you combine all your columns in one using the
> &.
> G1=A1&B1&D1&E1&F1
> In H1 you get the result when you use the COUNTIF function.
> H1=COUNTIF($G$1:$G$4;G1) Result=2
> H2=COUNTIF($G$1:$G$4;G2) Result=1
> H3=...
>
> Rene
>
>
> "shiro" <shiro@play.com> wrote in message
> news:uAMA4casIHA.3680@TK2MSFTNGP05.phx.gbl...
>> Hi,Thank's for the response
>> I work with excel 2000.Let see my sample data lay out
>>
>> Column : A B D E F G
>> DATA : OK C3S 81A.01 818 354 formula must
>> return
>> 2
>> NG C3S 81A.01 818 351 formula return
>> 1
>> NG C3S 81A.01 818 354 formula return
>> 1
>> OK C3S 81A.01 818 354 formula must
>> return 2
>>
>> From that data we can see there are two excatly same
>> data on row 1 and row 4.And I want to be able to count
>> the number of excatly similar data on cell G.
>>
>> The data type are :
>> A: Text
>> B: Text
>> D: Text
>> E: Number
>> F: Number
>>
>> I have tried SUMPRODUCT but it dependanciesonly to the value at column F.
>> Pivot table work fine but this time I need to try another way first
>> before
>> using
>> pivot table.
>>
>> Rgds,
>>
>>
>> Shiro
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> "Ron Rosenfeld" <ronrosenfeld@nospam.org> wrote in message
>> news:rf0624p49jbchtorhtfr2s2ip3g2826l3p@4ax.com...
>>> On Thu, 8 May 2008 20:26:47 +0800, "shiro" <shiro@play.com> wrote:
>>>
>>> >Hi all,
>>> >I am a newbie in excel and having a problem with
>>> >countif function.
>>> >Currently in the actual worksheet I was unable to
>>> >set a CountIf formula with multiple criteria.
>>> >Can we set it with excel VBA? Or just like using
>>> >Dlookup function to find excatly match row contents.
>>> >Please advise.
>>> >
>>> >Rgds,
>>> >
>>> >Shiro
>>> >
>>>
>>> What version of Excel are you using?
>>> --ron
>>
>>
>


Re: CountIf with VBA by Pete_UK

Pete_UK
Fri May 09 07:56:02 CDT 2008

You can't use full-column references in SUMPRODUCT in Excel 2000 -
specify the exact ranges (or make them a bit bigger).

Pete

On May 9, 1:39=A0pm, "shiro" <sh...@play.com> wrote:
> Mr Ron,
> this formula
> =3DSUMPRODUCT(--(G:N=3DG16),--(G:N=3DK16),--(G:N=3DL16),--(G:N=3DM16),--(G=
:N=3DN16))
> return #NUM! for me...
>


Re: CountIf with VBA by Ron

Ron
Fri May 09 08:20:06 CDT 2008

On Fri, 9 May 2008 20:39:13 +0800, "shiro" <shiro@play.com> wrote:

>Mr Ron,
>this formula
>=SUMPRODUCT(--(G:N=G16),--(G:N=K16),--(G:N=L16),--(G:N=M16),--(G:N=N16))
>return #NUM! for me...

Yes it will.

I did not use full-column references in my example, and you cannot in Excel
2000.

Change your references to something like:

G1:N65535 (or smaller) and it should work.

The smaller your range, the faster will be the calculation, so I wouldn't
unnecessarily make the reference as large as you have.
--ron

Re: CountIf with VBA by Rene

Rene
Fri May 09 17:17:14 CDT 2008

It works on my computer.
G1=A1 & B1 & D1 & E1 & F1
H1=COUNTIF($G$1:$G$4;G1) Result=2

Everytime

Rene

"shiro" <shiro@play.com> wrote in message
news:elxfP%23csIHA.2188@TK2MSFTNGP04.phx.gbl...
> I'm sorry Rene,does it work for you?It doesn't for me.
> It rationally to join all criteria in one cell but it always
> return 0 (zero) for me.
> Thank's for the response.
>
> Rgds,
>
> Shiro
>
>
> "Rene" <rene@yahoo.com> wrote in message
> news:e5fAffcsIHA.552@TK2MSFTNGP06.phx.gbl...
>> Make an extra column where you combine all your columns in one using the
> &.
>> G1=A1&B1&D1&E1&F1
>> In H1 you get the result when you use the COUNTIF function.
>> H1=COUNTIF($G$1:$G$4;G1) Result=2
>> H2=COUNTIF($G$1:$G$4;G2) Result=1
>> H3=...
>>
>> Rene
>>
>>
>> "shiro" <shiro@play.com> wrote in message
>> news:uAMA4casIHA.3680@TK2MSFTNGP05.phx.gbl...
>> > Hi,Thank's for the response
>> > I work with excel 2000.Let see my sample data lay out
>> >
>> > Column : A B D E F G
>> > DATA : OK C3S 81A.01 818 354 formula must
>> > return
>> > 2
>> > NG C3S 81A.01 818 351 formula
>> > return
> 1
>> > NG C3S 81A.01 818 354 formula
>> > return
> 1
>> > OK C3S 81A.01 818 354 formula must
>> > return 2
>> >
>> > From that data we can see there are two excatly same
>> > data on row 1 and row 4.And I want to be able to count
>> > the number of excatly similar data on cell G.
>> >
>> > The data type are :
>> > A: Text
>> > B: Text
>> > D: Text
>> > E: Number
>> > F: Number
>> >
>> > I have tried SUMPRODUCT but it dependanciesonly to the value at column
> F.
>> > Pivot table work fine but this time I need to try another way first
> before
>> > using
>> > pivot table.
>> >
>> > Rgds,
>> >
>> >
>> > Shiro
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > "Ron Rosenfeld" <ronrosenfeld@nospam.org> wrote in message
>> > news:rf0624p49jbchtorhtfr2s2ip3g2826l3p@4ax.com...
>> >> On Thu, 8 May 2008 20:26:47 +0800, "shiro" <shiro@play.com> wrote:
>> >>
>> >> >Hi all,
>> >> >I am a newbie in excel and having a problem with
>> >> >countif function.
>> >> >Currently in the actual worksheet I was unable to
>> >> >set a CountIf formula with multiple criteria.
>> >> >Can we set it with excel VBA? Or just like using
>> >> >Dlookup function to find excatly match row contents.
>> >> >Please advise.
>> >> >
>> >> >Rgds,
>> >> >
>> >> >Shiro
>> >> >
>> >>
>> >> What version of Excel are you using?
>> >> --ron
>> >
>> >
>>
>
>


Re: CountIf with VBA by shiro

shiro
Fri May 09 21:45:27 CDT 2008

Ups !!
Mr Ron,
My mistake.It works like you say.
Thank's.
But it mean we have to edit the formula if we add
new data.Did you think about a way to not editing
the formula if we add new data?


"Ron Rosenfeld" <ronrosenfeld@nospam.org> wrote in message
news:koj82454n9dnjqkmhbv5vfhbcdqv20a0n0@4ax.com...
> On Fri, 9 May 2008 20:39:13 +0800, "shiro" <shiro@play.com> wrote:
>
> >Mr Ron,
> >this formula
> >=SUMPRODUCT(--(G:N=G16),--(G:N=K16),--(G:N=L16),--(G:N=M16),--(G:N=N16))
> >return #NUM! for me...
>
> Yes it will.
>
> I did not use full-column references in my example, and you cannot in
Excel
> 2000.
>
> Change your references to something like:
>
> G1:N65535 (or smaller) and it should work.
>
> The smaller your range, the faster will be the calculation, so I wouldn't
> unnecessarily make the reference as large as you have.
> --ron



Re: CountIf with VBA by shiro

shiro
Fri May 09 21:51:43 CDT 2008

I can't get it.


"Rene" <rene@yahoo.com> wrote in message
news:#U8VuJisIHA.4952@TK2MSFTNGP05.phx.gbl...
> It works on my computer.
> G1=A1 & B1 & D1 & E1 & F1
> H1=COUNTIF($G$1:$G$4;G1) Result=2
>
> Everytime
>
> Rene
>
> "shiro" <shiro@play.com> wrote in message
> news:elxfP%23csIHA.2188@TK2MSFTNGP04.phx.gbl...
> > I'm sorry Rene,does it work for you?It doesn't for me.
> > It rationally to join all criteria in one cell but it always
> > return 0 (zero) for me.
> > Thank's for the response.
> >
> > Rgds,
> >
> > Shiro
> >
> >
> > "Rene" <rene@yahoo.com> wrote in message
> > news:e5fAffcsIHA.552@TK2MSFTNGP06.phx.gbl...
> >> Make an extra column where you combine all your columns in one using
the
> > &.
> >> G1=A1&B1&D1&E1&F1
> >> In H1 you get the result when you use the COUNTIF function.
> >> H1=COUNTIF($G$1:$G$4;G1) Result=2
> >> H2=COUNTIF($G$1:$G$4;G2) Result=1
> >> H3=...
> >>
> >> Rene
> >>
> >>
> >> "shiro" <shiro@play.com> wrote in message
> >> news:uAMA4casIHA.3680@TK2MSFTNGP05.phx.gbl...
> >> > Hi,Thank's for the response
> >> > I work with excel 2000.Let see my sample data lay out
> >> >
> >> > Column : A B D E F
G
> >> > DATA : OK C3S 81A.01 818 354 formula must
> >> > return
> >> > 2
> >> > NG C3S 81A.01 818 351 formula
> >> > return
> > 1
> >> > NG C3S 81A.01 818 354 formula
> >> > return
> > 1
> >> > OK C3S 81A.01 818 354 formula
must
> >> > return 2
> >> >
> >> > From that data we can see there are two excatly same
> >> > data on row 1 and row 4.And I want to be able to count
> >> > the number of excatly similar data on cell G.
> >> >
> >> > The data type are :
> >> > A: Text
> >> > B: Text
> >> > D: Text
> >> > E: Number
> >> > F: Number
> >> >
> >> > I have tried SUMPRODUCT but it dependanciesonly to the value at
column
> > F.
> >> > Pivot table work fine but this time I need to try another way first
> > before
> >> > using
> >> > pivot table.
> >> >
> >> > Rgds,
> >> >
> >> >
> >> > Shiro
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > "Ron Rosenfeld" <ronrosenfeld@nospam.org> wrote in message
> >> > news:rf0624p49jbchtorhtfr2s2ip3g2826l3p@4ax.com...
> >> >> On Thu, 8 May 2008 20:26:47 +0800, "shiro" <shiro@play.com> wrote:
> >> >>
> >> >> >Hi all,
> >> >> >I am a newbie in excel and having a problem with
> >> >> >countif function.
> >> >> >Currently in the actual worksheet I was unable to
> >> >> >set a CountIf formula with multiple criteria.
> >> >> >Can we set it with excel VBA? Or just like using
> >> >> >Dlookup function to find excatly match row contents.
> >> >> >Please advise.
> >> >> >
> >> >> >Rgds,
> >> >> >
> >> >> >Shiro
> >> >> >
> >> >>
> >> >> What version of Excel are you using?
> >> >> --ron
> >> >
> >> >
> >>
> >
> >
>



Re: CountIf with VBA by Ron

Ron
Fri May 09 22:05:19 CDT 2008

On Sat, 10 May 2008 10:45:27 +0800, "shiro" <shiro@play.com> wrote:

>Ups !!
>Mr Ron,
>My mistake.It works like you say.
>Thank's.
>But it mean we have to edit the formula if we add
>new data.Did you think about a way to not editing
>the formula if we add new data?

Since this formula will handle up to 65,535 rows of data, I did not consider
that you might be adding more. If so, you could change to Excel 2007, which
allows over 1,000,000 rows of data.
--ron