Question

Multiple Comma Seperated Entry LookUp

Asked by: Spanoird

Hi, I need to determine if several comma seperated entries in colum B exist in column A.  For example:
ColumnA      ColumnB
23423           12232, 314454, 42435
235565          25566, ,235432, 3234, 235666
2555              5345, 54534, 346777, 345345, 353454

What Excel formula would work for this need?
Thanks
Spanoird!

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-10-16 at 13:00:54ID24819273
Topic

Microsoft Excel Spreadsheet Software

Participating Experts
2
Points
250
Comments
28

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Add commas
    I have a list in excel and I need to add commas to each of the 700 items. Is there a way to automatically do that in excel or word so I do not have to do it manually?
  2. how to add a comma
    hi guys, I have a file with colum of emails to which i wish to add a comma (,). Which the best and quickest way to do this. or does anyone have the syntax for unix ? thanks e.g current file qwert@qwerty.com qwert@qwerty.com qwert@qwerty.com qwert@qwerty.com what I requir...
  3. remove comma
    Hi Experts How would you remove the comma from the following in cell A5 Paul, Jones and in cell L5 = Paul Jones No comma
  4. SQL - no duplicate row of combination of ColumnA and Col…
    This query is for quality check on a TableAB- query checks that there is no duplicate row with the same values of ColumnA and ColumnB. Example: ColumnA ColumnB ColumnC ColumnD 2 6 ...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: andreyman3d2kPosted on 2009-10-16 at 13:33:57ID: 25593096

what version of excel are you using?

 

by: andreyman3d2kPosted on 2009-10-16 at 13:43:20ID: 25593151

If I understood the question correctly, here is a formula you can use. It will only work in excel 2007.

 

by: andreyman3d2kPosted on 2009-10-16 at 13:43:47ID: 25593156

Sorry, it is in the attached file.

 

by: andreyman3d2kPosted on 2009-10-16 at 13:47:38ID: 25593192

The formula in this file will work in all versions of Excel

 

by: SpanoirdPosted on 2009-10-16 at 14:36:05ID: 25593560

Thanks andreyman3d2k,
I believe you are close, but it appears the search only accurs in that same line.   I need for the search to accur in the whole column?

Thanks
Spanoird

 

by: byundtPosted on 2009-10-16 at 15:29:12ID: 25593818

If you want to search many cells in column B for a value in column A, you might try a formula like:
=IF(COUNTIF(B$2:B$1000,"*" & A4 & "*"),"Exists","")

 

by: byundtPosted on 2009-10-16 at 15:34:24ID: 25593837

If you want to determine if any of the values in comma separated cell B2 are found in column A, then you might try a formula like:
=IF(SUM(COUNTIF(B2,"*" & A$2:A$1000 & "*")),"Exists","")

This formula is the opposite of the previous formula, which searched many cells in column B for a given value in column A.

Brad

 

by: SpanoirdPosted on 2009-10-19 at 08:07:37ID: 25605835

Hi Byundt,
thanks for your participation and I opologize for the delayed response back, I have attached a file that makes use of your second offered solution.   From what I can see it seems to not capture the desired results.    Could you review and let me know if I am missing someting.

I am require to perform qc validations on comma sperated data entered on column B to ensure it is found in column A.  

Thanks
Spanoird

 

by: SpanoirdPosted on 2009-10-19 at 08:18:07ID: 25605938

Disregard the previouse spreadsheet example attached, I realized it was an incomplete data set.   Please see update attached to this posting.

Thanks

 

by: SpanoirdPosted on 2009-10-19 at 09:07:51ID: 25606467

Points increased update.

 

by: SpanoirdPosted on 2009-10-20 at 09:16:06ID: 25615638

Anybody there?   Did I upset someone?

 

by: andreyman3d2kPosted on 2009-10-20 at 09:52:30ID: 25616047

Not sure of the solution to the problem (hence I stopped commenting : ) but I do know a reason why this won't work, at least the way it is now:

=IF(SUM(COUNTIF(B2,"*" & A$2:A$1000 & "*")),"Exists","")

this is taking B2 as having the value you are looking for, however it can have multiple value in the one cell...

 

by: andreyman3d2kPosted on 2009-10-20 at 09:53:23ID: 25616055

if there were no comma spearated values in the B column, this would work:

=IF(ISERROR(VLOOKUP(B2,$A$2:$A$3447,1,FALSE)),"Error","")

 

by: SpanoirdPosted on 2009-10-20 at 10:56:26ID: 25616707

Thanks for the comments andrewman3d2k,

unfortunely columnB will always have multi comma delimited entries that will need to be validated through columnA.

Carlos

 

by: andreyman3d2kPosted on 2009-10-20 at 13:34:54ID: 25618268

how's this for you?

NOTICE -- The formatting in columns a and b has been changed to text. THis is necessary for this to work.

 

by: SpanoirdPosted on 2009-10-21 at 11:29:52ID: 25626819

Thanks AndrewMan3d2k!
The formula look to be the best promising so far, I believe with a bit of tweaking we can get it thier.  Smart move to take it to text format.

I checked the results of your new formula and found that 4 out of the 10 reported as not found "No" in the B columns were found when searched manually.

Thanks for sticking with me a bit longer.   I am also hard at work in seeking a solution.  Thanks a bunch man!

Carlos

706211345	TRUE
2600290	TRUE
177386	TRUE
11918	not true
11918	not true
E-1-1010	not true
E-1-1010	not true
194672	TRUE
194672	TRUE
3400074	TRUE
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:

Select allOpen in new window

 

by: andreyman3d2kPosted on 2009-10-21 at 11:56:08ID: 25627102

On my spreadsheet the number 11918 does not exist in column A

there is:

0000111918

 

by: SpanoirdPosted on 2009-10-21 at 12:07:08ID: 25627202

You are right, this only leaves the text base entries to contend with (E-1-1010, E-1-1080, ext.)

 

by: byundtPosted on 2009-10-21 at 12:28:50ID: 25627404

I didn't like the slow speed of my formula. I therefore decided to write some VBA code to do the job.

The attached workbook contains a user-defined function in column D that checks whether each of the comma separated values in column B is present somewhere in column A using a formula like:
=Matcher(B2,A:A)

If you only need to find one of the comma separated values, then the formula (shown in column E) would be:
=Matcher(B2,A:A,",",FALSE)

It is worth noting that you have a mix of numbers, text and text that looks like numbers in column A. The text that looks like numbers is a big problem because you won't be finding a match for it. See cell A215 in the Sheet1 sorted worksheet, for example.

To convert text that looks like numbers into real numbers:

1)     Copy a blank cell
2)     Select the cells in column A
3)     Open the Edit&Paste Special menu item and choose the option for Add

It is also worth noting that you made the calculation mode Manual. So if you make changes, you must hit F9 to force the recalculation.

Finally, because the searching is done using a user-defined function, you must enable macros. If you have Excel 2003 or earlier, you'll get a macro warning message when you open the workbook. In Excel 2007, you see a macro warning message above the first row of data. If you don't see the warning message, then you need to change your macro security to Medium (Excel 2003) or to Disable unsigned macros with warning in Excel 2007 (I'm not sure of the exact wording of the Excel 2007 message).

Brad

'Put in a regular module sheet
Function Matcher(sMatch As String, rgData As Range, _
    Optional sDelimiter As String = ",", Optional bMatchEach As Boolean = True, Optional bMatchAll As Boolean = True) As String
Dim vMatch As Variant, vMatches As Variant
Dim bFoundOne As Boolean
Dim cel As Range
Matcher = ""
If sMatch <> "" Then
    On Error Resume Next
    For Each vMatch In Split(sMatch, sDelimiter)
        vMatch = Trim(vMatch)
        If IsNumeric(vMatch) Then vMatch = Val(vMatch)
        Set cel = Nothing
        Set cel = rgData.Find(vMatch, LookAt:=IIf(bMatchAll, xlWhole, xlPart))
        If (cel Is Nothing) And (bMatchEach = True) Then
            Matcher = "Error"
            On Error GoTo 0
            Exit Function
        ElseIf Not cel Is Nothing Then
            bFoundOne = True
            If bMatchEach = False Then
                On Error GoTo 0
                Exit Function
            End If
        End If
    Next
    If bFoundOne = False Then Matcher = "Error"
    On Error GoTo 0
End If
End Function
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:

Select allOpen in new window

  • Matcher.xls
    • 1.4 MB

    Sample file with user-defined function

 

by: SpanoirdPosted on 2009-10-21 at 15:54:39ID: 25629326

Guys,
I apologize; I have been swapped with other work and have not had a chance to test these solutions out.    Give me until tomorrow to provide feed abck.    Do appreciate your assistance in seeking a solution for me though!

Both methods look promising, more to come...

Carlos

 

by: SpanoirdPosted on 2009-10-22 at 11:54:07ID: 25637668

andreyman3d2k, your assistance with this problem produce a formula that did capture some of the entry errors, so I have awarded points to you.   Do want to thank you for sticking it out!  Your formula appears to be usable in other areas as well.   Thank You!

Brad, your formula hit the mark I was able to identify key entry errors building my confidence in my data and business use.   Your VBA code was the ticket!  I always wanted to 'dabble' in VBA and with this need and your code I have learned to make use of VBA, Thanks a million!

Great work Guys!   Till next time, have a good day!
Carlos

 

by: andreyman3d2kPosted on 2009-10-22 at 11:59:36ID: 25637715

Glad to be of some help. Thanks for the points & interesting question.

 

by: SpanoirdPosted on 2009-10-27 at 16:17:30ID: 25678723

Brad,
what formula would be needed for the reverse qc check?  To check if single entry in columnA exist in a comma seperated multy entry in colum B.  For example:
ColumnA      ColumnB
23423           12232, 314454, 42435
235565          25566, ,235432, 3234, 235666
2555              5345, 54534, 346777, 345345, 353454

Let me know if this warrants posting a new question all together or similar and would require a quick tweak.

Thank You!
Carlos

 

by: byundtPosted on 2009-10-27 at 17:45:52ID: 25679116

Carlos,
The reverse QC check is covered by the formula in http:/#25593818

To search many cells in column B for a value in column A, you might try a formula like:
=IF(SUM(COUNTIF(B$2:B$4000,{A2,"*" & A2 & "*"})),"Exists","Not found")

This formula ignores any leading zeros in cell A2. It converts the value in cell A2 into text, and so doesn't care whether A2 is a number or text that looks like a number. The bit with the curly braces and SUM is to trap single values entered as numbers in column B.

Brad

 

by: SpanoirdPosted on 2009-10-28 at 10:22:27ID: 25685741

Brad,
in using the formula =IF(SUM(COUNTIF(B$2:B$4000,{A2,"*" & A2 & "*"})),"Exists","Not found") I get the following error message "The formula you typed contains an error".   I tried several substitutions and variations to hope it would work?

Carlos

 

by: byundtPosted on 2009-10-28 at 12:12:02ID: 25687037

Carlos,
I tested the formula using real values, then substituted in the cell references--forgetting that cell references can't appear inside the array constant. The following formula works in Excel 2003 exactly as posted.

=IF(COUNTIF(B$2:B$4000,A2)+COUNTIF(B$2:B$4000,"*" & A2 & "*"),"Exists","Not found")

Sorry about the inconvenience.

Brad

 

by: SpanoirdPosted on 2009-10-29 at 07:24:31ID: 25694008

Brad,
not a problem, on the contrary.   The change did the trick, great formula!

I want to award you points, is there still an opportunity when closed, or should I create a new ticket.

Thanks a Million!
Carlos

 

by: byundtPosted on 2009-10-29 at 11:06:56ID: 25696421

Carlos,
Don't worry about the points. This was a pretty simple extension to your original question, and Experts-Exchange likes to keep all the discussion on implementation in the original thread because it adds value to the question in their database.

Brad

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...