A Microsoft Excel forum. ExcelBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » ExcelBanter forum » Excel Newsgroups » Excel Discussion (Misc queries)
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Search for either one or the other



 
 
Thread Tools Display Modes
  #1  
Old August 7th 12, 10:09 AM
blivy blivy is offline
Junior Member
 
First recorded activity by ExcelBanter: Aug 2012
Posts: 4
Default Search for either one or the other

Hi,

I'm trying to count the number of entries in a range B2:B1847 that are either
BKROCK
BLACKRCK
BLACKROCK
BLACROCK
BLK RCK
BLKRCK
BLKRK
BLKRO
BLKROCK
(note that these all have numerous strings of differing amounts of numbers on the end so I cannot use a RIGHT function)

The formula I had been using up until now was
=SUMPRODUCT((#other criteria#)*(LEFT(B2:B1847,2)="BL"))
but this returns BLACK RIVER which I don't want to count and doesn't include BKROCK OR BLKRO.

I also tried the following:
=SUMPRODUCT((#other criteria#)*(ISNUMBER(SEARCH("CK",B2:B1847))))
but this counts MAVERICK CAPITAL as well and not BLKRO.

I wondered if I could perhaps combine a SEARCH and OR function as follows
=SUMPRODUCT((#other criteria#)*(ISNUMBER(SEARCH(OR("BKROCK","BLACKRCK" ,"BLACKROCK","BLACROCK","BLK RCK","BLKRCK","BLKRK","BLKRO","BLKROCK"
),B2:B1847))))
but it just returns the value 0.


Does anyone know what I'm doing wrong and if there is another way around it?
Thanks!

Last edited by blivy : August 7th 12 at 10:18 AM. Reason: Realised there were extra Black Rock variations
Ads
  #2  
Old August 7th 12, 05:07 PM posted to microsoft.public.excel.misc
Don Guillett[_2_]
external usenet poster
 
Posts: 1,506
Default Search for either one or the other

On Tuesday, August 7, 2012 4:09:17 AM UTC-5, blivy wrote:
> Hi,
>
>
>
> I'm trying to count the number of entries in a range B2:B1847 that are
>
> either
>
> BKROCK
>
> BLACKRCK
>
> BLACKROCK
>
> BLACROCK
>
> BLK RCK
>
> BLKRCK
>
> BLKRK
>
> BLKRO
>
> BLKROCK
>
> (note that these all have numerous strings of differing amounts of
>
> numbers on the end so I cannot use a RIGHT function)
>
>
>
> The formula I had been using up until now was
>
> =SUMPRODUCT((#other criteria#)*(LEFT(B2:B1847,2)="BL"))
>
> but this returns BLACK RIVER which I don't want to count and doesn't
>
> include BKROCK OR BLKRO.
>
>
>
> I also tried the following:
>
> =SUMPRODUCT((#other criteria#)*(ISNUMBER(SEARCH("CK",B2:B1847))))
>
> but this counts MAVERICK CAPITAL as well and not BLKRO.
>
>
>
> I wondered if I could perhaps combine a SEARCH and OR function as
>
> follows
>
> =SUMPRODUCT((#other
>
> criteria#)*(ISNUMBER(SEARCH(OR("BKROCK","BLACKRCK" ,"BLACKROCK","BLACROCK","BLK
>
> RCK","BLKRCK","BLKRK","BLKRO","BLKROCK"
>
> ),B2:B1847))))
>
> but it just returns the value 0.
>
>
>
>
>
> Does anyone know what I'm doing wrong and if there is another way around
>
> it?
>
> Thanks!
>
>
>
>
>
>
>
>
>
> --
>
> blivy


  #3  
Old August 7th 12, 05:10 PM posted to microsoft.public.excel.misc
Don Guillett[_2_]
external usenet poster
 
Posts: 1,506
Default Search for either one or the other

On Tuesday, August 7, 2012 4:09:17 AM UTC-5, blivy wrote:
> Hi,
>
>
>
> I'm trying to count the number of entries in a range B2:B1847 that are
>
> either
>
> BKROCK
>
> BLACKRCK
>
> BLACKROCK
>
> BLACROCK
>
> BLK RCK
>
> BLKRCK
>
> BLKRK
>
> BLKRO
>
> BLKROCK
>
> (note that these all have numerous strings of differing amounts of
>
> numbers on the end so I cannot use a RIGHT function)
>
>
>
> The formula I had been using up until now was
>
> =SUMPRODUCT((#other criteria#)*(LEFT(B2:B1847,2)="BL"))
>
> but this returns BLACK RIVER which I don't want to count and doesn't
>
> include BKROCK OR BLKRO.
>
>
>
> I also tried the following:
>
> =SUMPRODUCT((#other criteria#)*(ISNUMBER(SEARCH("CK",B2:B1847))))
>
> but this counts MAVERICK CAPITAL as well and not BLKRO.
>
>
>
> I wondered if I could perhaps combine a SEARCH and OR function as
>
> follows
>
> =SUMPRODUCT((#other
>
> criteria#)*(ISNUMBER(SEARCH(OR("BKROCK","BLACKRCK" ,"BLACKROCK","BLACROCK","BLK
>
> RCK","BLKRCK","BLKRK","BLKRO","BLKROCK"
>
> ),B2:B1847))))
>
> but it just returns the value 0.
>
>
>
>
>
> Does anyone know what I'm doing wrong and if there is another way around
>
> it?
>
> Thanks!
>
>
>
>
>
>
>
>
>
> --
>
> blivy


=SUMPRODUCT((#other criteria#)*(LEFT(B2:B1847,2)="BL"))

On Tuesday, August 7, 2012 4:09:17 AM UTC-5, blivy wrote:
> Hi,
>
>
>
> I'm trying to count the number of entries in a range B2:B1847 that are
>
> either
>
> BKROCK
>
> BLACKRCK
>
> BLACKROCK
>
> BLACROCK
>
> BLK RCK
>
> BLKRCK
>
> BLKRK
>
> BLKRO
>
> BLKROCK
>
> (note that these all have numerous strings of differing amounts of
>
> numbers on the end so I cannot use a RIGHT function)
>
>
>
> The formula I had been using up until now was
>
> =SUMPRODUCT((#other criteria#)*(LEFT(B2:B1847,2)="BL"))
>
> but this returns BLACK RIVER which I don't want to count and doesn't
>
> include BKROCK OR BLKRO.
>
>
>
> I also tried the following:
>
> =SUMPRODUCT((#other criteria#)*(ISNUMBER(SEARCH("CK",B2:B1847))))
>
> but this counts MAVERICK CAPITAL as well and not BLKRO.
>
>
>
> I wondered if I could perhaps combine a SEARCH and OR function as
>
> follows
>
> =SUMPRODUCT((#other
>
> criteria#)*(ISNUMBER(SEARCH(OR("BKROCK","BLACKRCK" ,"BLACKROCK","BLACROCK","BLK
>
> RCK","BLKRCK","BLKRK","BLKRO","BLKROCK"
>
> ),B2:B1847))))
>
> but it just returns the value 0.
>
>
>
>
>
> Does anyone know what I'm doing wrong and if there is another way around
>
> it?
>
> Thanks!
>
>
>
>
>
>
>
>
>
> --
>
> blivy

Change this to suit your ACTUAL NAMES using the array { }

=SUMPRODUCT((#other criteria#)*(LEFT(B2:B1847,2)={"BL","b","c"}))
  #4  
Old August 7th 12, 05:49 PM posted to microsoft.public.excel.misc
Claus Busch
external usenet poster
 
Posts: 943
Default Search for either one or the other

Hi,

Am Tue, 7 Aug 2012 09:09:17 +0000 schrieb blivy:

> I wondered if I could perhaps combine a SEARCH and OR function as
> follows
> =SUMPRODUCT((#other
> criteria#)*(ISNUMBER(SEARCH(OR("BKROCK","BLACKRCK" ,"BLACKROCK","BLACROCK","BLK
> RCK","BLKRCK","BLKRK","BLKRO","BLKROCK"
> ),B2:B1847))))
> but it just returns the value 0.


try:
=COUNT(SEARCH({"BKROCK","BLACKRCK","BLACKROCK","BL ACROCK","BLKRCK","BLKRK","BLKRO","BLKROCK"},B2:B18 47))
and enter the formula with CRTL+Shift+Enter


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
  #5  
Old August 7th 12, 06:35 PM posted to microsoft.public.excel.misc
Ron Rosenfeld[_2_]
external usenet poster
 
Posts: 894
Default Search for either one or the other

On Tue, 7 Aug 2012 09:09:17 +0000, blivy > wrote:

>Hi,
>
>I'm trying to count the number of entries in a range B2:B1847 that are
>either
>BKROCK
>BLACKRCK
>BLACKROCK
>BLACROCK
>BLK RCK
>BLKRCK
>BLKRK
>BLKRO
>BLKROCK
>(note that these all have numerous strings of differing amounts of
>numbers on the end so I cannot use a RIGHT function)


I assume these strings are only a portion of the cells contents.

If you have a list of the desired substrings in some range, e.g: K1:K9, you can try this formula for a case INsensitive match:

=SUMPRODUCT(COUNTIF($B$2:$B$1847,"*"&$K$1:$K$9&"*" ))
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Search string to search for wild terms in Access database gab1972 Excel Programming 0 January 27th 10 05:37 PM
Set up search box to, by default, search workbook in the extraoptions? StargateFanNotAtHome[_2_] Excel Programming 2 September 3rd 09 03:42 PM
Search lastname + firstname (search on uppercase) Fr. Vandecan Excel Programming 2 April 8th 07 03:11 PM
How do I search excel spreadsheets using multiple search criteria. Kasper Excel Worksheet Functions 4 December 15th 05 12:26 AM
Create a search Field within a worksheet to search command buttons Ed P[_2_] Excel Programming 1 December 14th 04 08:04 PM


All times are GMT +1. The time now is 07:15 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright ©2004-2013 ExcelBanter.
The comments are property of their posters.