Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 158
Default Count rows with a string in any cell

I'm trying to engineer a function that counts the number of rows which have a
certain string in any cell. The string could appear in any of about nine
different cells within each row. I thought this would be easy using COUNTIF
inside SUMPRODUCT, but I am not quite getting it. TIA.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,688
Default Count rows with a string in any cell

Hi!

Kind of light on details.........

Assume the range is A1:I5. The string = "try".

Entered as an array using the key combination of CTRL,SHIFT,ENTER:

=SUM(--(MMULT(--(A1:I5="try"),TRANSPOSE(COLUMN(A1:I5)^0))0))

Biff

"andy62" wrote in message
...
I'm trying to engineer a function that counts the number of rows which
have a
certain string in any cell. The string could appear in any of about nine
different cells within each row. I thought this would be easy using
COUNTIF
inside SUMPRODUCT, but I am not quite getting it. TIA.



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 158
Default Count rows with a string in any cell

OMG, thank you (and Harlan), I guess this wasn't so straightforward after all.

"Biff" wrote:

Hi!

Kind of light on details.........

Assume the range is A1:I5. The string = "try".

Entered as an array using the key combination of CTRL,SHIFT,ENTER:

=SUM(--(MMULT(--(A1:I5="try"),TRANSPOSE(COLUMN(A1:I5)^0))0))

Biff

"andy62" wrote in message
...
I'm trying to engineer a function that counts the number of rows which
have a
certain string in any cell. The string could appear in any of about nine
different cells within each row. I thought this would be easy using
COUNTIF
inside SUMPRODUCT, but I am not quite getting it. TIA.




  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,688
Default Count rows with a string in any cell

You're welcome!

Biff

"andy62" wrote in message
...
OMG, thank you (and Harlan), I guess this wasn't so straightforward after
all.

"Biff" wrote:

Hi!

Kind of light on details.........

Assume the range is A1:I5. The string = "try".

Entered as an array using the key combination of CTRL,SHIFT,ENTER:

=SUM(--(MMULT(--(A1:I5="try"),TRANSPOSE(COLUMN(A1:I5)^0))0))

Biff

"andy62" wrote in message
...
I'm trying to engineer a function that counts the number of rows which
have a
certain string in any cell. The string could appear in any of about
nine
different cells within each row. I thought this would be easy using
COUNTIF
inside SUMPRODUCT, but I am not quite getting it. TIA.






  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 733
Default Count rows with a string in any cell

andy62 wrote...
I'm trying to engineer a function that counts the number of rows which have a
certain string in any cell. The string could appear in any of about nine
different cells within each row. I thought this would be easy using COUNTIF
inside SUMPRODUCT, but I am not quite getting it. TIA.


As long as you're not trying to search all 65536 rows, you could use
something like the following array formula.

=SUM(--(MMULT(-ISNUMBER(SEARCH("*XyZ*",Rng)),TRANSPOSE(COLUMN(Rng )))<0))

This uses only nonvolatile functions. At th



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 733
Default Count rows with a string in any cell

andy62 wrote...
I'm trying to engineer a function that counts the number of rows which have a
certain string in any cell. The string could appear in any of about nine
different cells within each row. I thought this would be easy using COUNTIF
inside SUMPRODUCT, but I am not quite getting it. TIA.


As long as you're not trying to search all 65536 rows, you could use
something like the following array formula.

=SUM(--(MMULT(-ISNUMBER(SEARCH("*XyZ*",Rng)),TRANSPOSE(COLUMN(Rng )))<0))

This uses only nonvolatile functions. At the cost of some performance,
you could use OFFSET to shorten the the array formula.

=SUM(--(COUNTIF(OFFSET(Rng,ROW(Rng)-MIN(ROW(Rng)),0,1,),"*XyZ*")0))

That's not much shorter, so I'd prefer the longer, nonvolatile formula
myself.

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
List File Properties - Author SS Excel Worksheet Functions 1 June 23rd 06 04:56 PM
Help with this conditional IF statement C-Dawg Excel Discussion (Misc queries) 3 May 15th 06 06:01 PM
resetting last cell jagdish.eashwar Excel Discussion (Misc queries) 11 March 31st 06 02:06 AM
copying cell names Al Excel Discussion (Misc queries) 12 August 11th 05 03:01 PM
Convert rows into 1 cell or 1 string Yagnesh Excel Worksheet Functions 5 August 3rd 05 07:39 PM


All times are GMT +1. The time now is 04:13 AM.

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"