ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro with count if (https://www.excelbanter.com/excel-discussion-misc-queries/169553-macro-count-if.html)

orquidea

Macro with count if
 

Hi:

I want to create a macro that counts the rows wich have -P in any part of
the word. I will create 2 variables PU= total of rows with -P and IN=total
of rows without -P.

A
CCNG-PU
CNDLF
DLKJFOE
CNFIE-PU
3540-PU
DLREI

Could anyone help me with it please.

Thanks in advance

Orquidea

Bob Phillips

Macro with count if
 
PU=Activesheet.Evaluate("SUMPRODUCT(--(ISNUMBER(SEARCH("-P",A2:A200))))")

IN = Application.COUNTA(A:A) - PU

--
HTH

Bob

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

"orquidea" wrote in message
...

Hi:

I want to create a macro that counts the rows wich have -P in any part of
the word. I will create 2 variables PU= total of rows with -P and
IN=total
of rows without -P.

A
CCNG-PU
CNDLF
DLKJFOE
CNFIE-PU
3540-PU
DLREI

Could anyone help me with it please.

Thanks in advance

Orquidea




orquidea

Macro with count if
 
Hi Bob

Thanks for your help. I was trying the subprocedure but a "syntax error"
pops up in the first line, it highlights this part.("-P",A2:A200))))")

Could you please help to make it work?

Thanks in advance.


"Bob Phillips" wrote:

PU=Activesheet.Evaluate("SUMPRODUCT(--(ISNUMBER(SEARCH("-P",A2:A200))))")

IN = Application.COUNTA(A:A) - PU

--
HTH

Bob

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

"orquidea" wrote in message
...

Hi:

I want to create a macro that counts the rows wich have -P in any part of
the word. I will create 2 variables PU= total of rows with -P and
IN=total
of rows without -P.

A
CCNG-PU
CNDLF
DLKJFOE
CNFIE-PU
3540-PU
DLREI

Could anyone help me with it please.

Thanks in advance

Orquidea






All times are GMT +1. The time now is 01:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com