string compare with wildcards

  • Thread starter Thread starter Marcus Hoffmann
  • Start date Start date
M

Marcus Hoffmann

Hi folks,

may be a stupid question, I want to use the following formula to fill a cell:

{=SUM((D3:D113="STRING")*B3:B113)}

which works fine, but accepting all kinds of "STRING*",
like: "STRING1", "STRING2222",...

is there an easy way ???

thanx in advance
marcus
 
Marcus,

Use

=SUM((LEFT(D3:D113,6)="STRING")*(B3:B113))

as an array formula, or

=SUMPRODUCT(--(LEFT(D3:D113,6)="STRING"),B3:B113)

as a non-array formula.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Marcus,

try SEARCH worksheet function...

for your purpose:
=SUMPRODUCT(--NOT(ISERROR(SEARCH("string";D3:D113)));B3:B113)

notes:
search is case INSENSITIVE
search will accept arrays in both 1st and 2nd argument.
-- is a unary minus operator used to convert the boolean to a number.
FWIW: NO need to enter sumproduct as an array formula.


HTH... but fairly sure it does :)


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Marcus Hoffmann wrote :
 
another note:

search will also find "myString" so be carefull if that
is not desired. Since it will return the position
in the teststring you'll just have to test that it returns 1

pity it returns an error iso a simple 0 if the string
is not found.



--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


keepITcool wrote :
 

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

Back
Top