PC Review


Reply
Thread Tools Rate Thread

compaing data in columns

 
 
john.9.williams@bt.com
Guest
Posts: n/a
 
      24th Feb 2009
Hi,

I have two sets of data, data in sheet 1 column a has about 400 rows
in each row there is data with wild cards, sheet 2 have about 4000
rows and has the data without the wild cards, i want to be able to
what data in sheet2 appears in sheet 1, cannot seem to get this to
work, example data shown below

Sheet 1 Sheet 2

APAXX12 APADR12
APAXX34 APATY89
APRXX89 APRJNDT
APRXXDT

x Is the wild card in sheet1

Please Help i am going crazy!!
 
Reply With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      24th Feb 2009
Try this code. You will get 0 if there arre no matches, otherwise, the
result will be the number of matches

=Sumproduct(--(left(Sheet1!A1:A100,3)&Right(Sheet1!A1:A100,2)=left(A1,3)&Right(A1,2)))

"(E-Mail Removed)" wrote:

> Hi,
>
> I have two sets of data, data in sheet 1 column a has about 400 rows
> in each row there is data with wild cards, sheet 2 have about 4000
> rows and has the data without the wild cards, i want to be able to
> what data in sheet2 appears in sheet 1, cannot seem to get this to
> work, example data shown below
>
> Sheet 1 Sheet 2
>
> APAXX12 APADR12
> APAXX34 APATY89
> APRXX89 APRJNDT
> APRXXDT
>
> x Is the wild card in sheet1
>
> Please Help i am going crazy!!
>

 
Reply With Quote
 
Geoffrey
Guest
Posts: n/a
 
      24th Feb 2009
On 24 Feb, 11:19, Joel <J...@discussions.microsoft.com> wrote:
> Try this code. *You will get 0 if there arre no matches, otherwise, the
> result will be the number of matches
>
> =Sumproduct(--(left(Sheet1!A1:A100,3)&Right(Sheet1!A1:A100,2)=left(A1,3)&Ri*ght(A1,2)))
>
>
>
> "john.9.willi...@bt.com" wrote:
> > Hi,

>
> > I have two sets of data, data in sheet 1 column a has about 400 rows
> > in each row there is data with wild cards, sheet 2 have about 4000
> > rows and has the data without the wild cards, i want to be able to
> > what data in sheet2 appears in sheet 1, *cannot seem to get this to
> > work, example data shown below

>
> > Sheet 1 * * * * * * * * * * *Sheet 2

>
> > APAXX12 * * * * * * * * * APADR12
> > APAXX34 * * * * * * * * * APATY89
> > APRXX89 * * * * * * * * * APRJNDT
> > APRXXDT

>
> > x Is the wild card in sheet1

>
> > Please Help i am going crazy!!- Hide quoted text -

>
> - Show quoted text -


There may be a more elegant way to do this in code and I'm sure somone
will say so if there is, but I would do it like this:

If code2 Like searchTerm(code1) Then <your action>

Where searchTerm is a function that converts your Xs into VBA ?
wildcards:

Function searchTerm(rawTerm As String) As String
Dim i As Integer

For i = 1 To Len(rawTerm)
If Mid(rawTerm, i, 1) = "X" Then
searchTerm = searchTerm & "?"
Else
searchTerm = searchTerm & Mid(rawTerm, i, 1)
End If
Next

End Function


This function assumes that your Xs will always be upper case but it
allows them to be anywhere in the string.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting Data into columns without replacing the columns with data =?Utf-8?B?U2FuZGFpbWU=?= Microsoft Excel New Users 2 18th Oct 2007 01:35 PM
Help in code Steve G wrote to move data from 4 columns to 21 columns Steve G Microsoft Excel Programming 9 2nd Aug 2007 02:43 PM
Compaing two arrays when element order does not matter ssg31415926 Microsoft C# .NET 38 8th Mar 2006 10:23 AM
Mixing data bound columns with hand coded columns Frank Grubbs Microsoft ADO .NET 0 9th Jun 2004 05:36 PM
Compaing xml files! C# newbie Microsoft C# .NET 0 6th Apr 2004 11:12 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:52 AM.