Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 331
Default wild character in function?

Lets say I have few companies and each of company can have 100s different
products. Products are defined as string and string can be a combinations of
text and numbers (acme5), special characters (Acme_100, acme.tools) What is
the best function to find customer? I tried =IF(A1="acm*","Acme",0), but
returned value is always false. What is the best way, function to select
specific customer? I dont want to count them, I want to assign customer
name to each customer. Thank you.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default wild character in function?

Here's one way:

If you only have a few names to lookup and the name is *always* at the
beginning of the string:

Assume the company names a Acme, Blah, Tidy and Red.

=IF(LEFT(A1,4)="Acme","Acme",IF(LEFT(A1,4)="Blah", "Blah",IF(LEFT(A1,4)="Tidy","Tidy",IF(LEFT(A1,3)=" Red","Red",""))))

Or this one (doesn't matter where the name is located within the string):

=LOOKUP(2,1/(ISNUMBER(SEARCH({"Acme","Blah","Tidy","Red"},A1)) ),{"Acme","Blah","Tidy","Red"})

If you have more than a few names then list those names in a range of cells
like F1:F20, then:

=LOOKUP(2,1/(ISNUMBER(SEARCH(F$1:F$20,A1))),F$1:F$20)

--
Biff
Microsoft Excel MVP


"Greg" wrote in message
...
Lets say I have few companies and each of company can have 100's
different
products. Products are defined as string and string can be a combinations
of
text and numbers (acme5), special characters (Acme_100, acme.tools) What
is
the best function to find customer? I tried =IF(A1="acm*","Acme",0), but
returned value is always false. What is the best way, function to select
specific customer? I don't want to count them, I want to assign customer
name to each customer. Thank you.



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,202
Default wild character in function?

I'm not sure what ultimate formula you are looking for, but here is a
wild-card (and case insensitive) logical test that matches the one you
posted...

=IF(ISERR(SEARCH("acm*",A1)),0,"Acme")

Note that this reverses the location of what you had for the TRUE and FALSE
locations. We can flip that around if you insist (at the cost of another
function call)...

=IF(NOT(ISERR(SEARCH("acm*",A1))),"Acme",0)

Rick


"Greg" wrote in message
...
Lets say I have few companies and each of company can have 100s
different
products. Products are defined as string and string can be a combinations
of
text and numbers (acme5), special characters (Acme_100, acme.tools) What
is
the best function to find customer? I tried =IF(A1="acm*","Acme",0), but
returned value is always false. What is the best way, function to select
specific customer? I dont want to count them, I want to assign customer
name to each customer. Thank you.


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 468
Default wild character in function?

Greg,

I think a UDF if what you need.

Copy this into a standard module:

Public Function ExtractCharsOnly(sStr1 As String)
Dim i As Long, sStr As String
Dim sChr As String
For i = 1 To Len(sStr1)
sChr = Mid(sStr1, i, 1)
If sChr Like "[A-Za-z]" Then
sStr = sStr & sChr
Else
Exit For
End If
Next
ExtractCharsOnly = sStr
End Function

Then with your data in column C in blank column ( say D) enter:
=ExtractCharOnly(C2)

Let me know if you like..

Jim

"Greg" wrote:

Lets say I have few companies and each of company can have 100s different
products. Products are defined as string and string can be a combinations of
text and numbers (acme5), special characters (Acme_100, acme.tools) What is
the best function to find customer? I tried =IF(A1="acm*","Acme",0), but
returned value is always false. What is the best way, function to select
specific customer? I dont want to count them, I want to assign customer
name to each customer. Thank you.

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
wild card with if logical function b166er Excel Worksheet Functions 7 June 1st 06 09:46 PM
wild card with if logical function b166er New Users to Excel 1 June 1st 06 06:42 PM
wild card with if logical function b166er New Users to Excel 1 June 1st 06 09:27 AM
wild card with if logical function b166er Excel Worksheet Functions 0 June 1st 06 08:17 AM
wild card with if logical function b166er Excel Worksheet Functions 2 May 30th 06 11:20 AM


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

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

About Us

"It's about Microsoft Excel"