Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
toyota58
 
Posts: n/a
Default How to find MATCH numbers ?

Hello,


Anybody knows how to find MATCH numbers ?

Example :

Cell A1 = 1457
Cell A2 = 2467

Return MATCH numbers are 4 and 7.



Thank You.

  #2   Report Post  
Stefi
 
Posts: n/a
Default

Hi Toyota58,

This UDF will do it:

Public Function Matchdigits(string1 As String, string2 As String) As String
Dim length As Integer
length = WorksheetFunction.Min(Len(string1), Len(string2))
matchdigits = ""
For l = 1 To length
If Mid(string1, l, 1) = Mid(string2, l, 1) Then Matchdigits =
Matchdigits & Mid(string1, l, 1)
Next l
End Function

Put in the cell you want the result in

=Matchdigits(A1,A2)

Regards,
Stefi

€˛toyota58€¯ ezt Ć*rta:

Hello,


Anybody knows how to find MATCH numbers ?

Example :

Cell A1 = 1457
Cell A2 = 2467

Return MATCH numbers are 4 and 7.



Thank You.


  #3   Report Post  
toyota58
 
Posts: n/a
Default

Sorry...I'm a newbie. Am I doing the right thing ? I went to TOOLS
MAKRO VB Editor (ALT + F11) Insert module...copy and paste ...all
I get is Syntax error...


If Mid(string1, l, 1) = Mid(string2, l, 1) Then Matchdigits =
Matchdigits & Mid(string1, l, 1)


..

  #4   Report Post  
Biff
 
Posts: n/a
Default

Hi!


If Mid(string1, l, 1) = Mid(string2, l, 1) Then Matchdigits =
Matchdigits & Mid(string1, l, 1)


This UDF works but the problem is line wrap. The above code needs to be all
on one line or use the line continuation character: _ (underscore)

If Mid(string1, l, 1) = Mid(string2, l, 1) Then Matchdigits = _
Matchdigits & Mid(string1, l, 1)

Biff

"toyota58" wrote in message
oups.com...
Sorry...I'm a newbie. Am I doing the right thing ? I went to TOOLS
MAKRO VB Editor (ALT + F11) Insert module...copy and paste ...all
I get is Syntax error...


If Mid(string1, l, 1) = Mid(string2, l, 1) Then Matchdigits =
Matchdigits & Mid(string1, l, 1)


.



  #5   Report Post  
toyota58
 
Posts: n/a
Default

Dear Stefi and Biff,

Thank You so much . It works OK now.



  #6   Report Post  
toyota58
 
Posts: n/a
Default

Very sorry again but ...the formula can only work in a certain way.

Example

Cell A1 = 2469
Cell A2 = 1359
Cell A3 = 9 This works OK


But it won't work if...

Cell A1 = 24569
Cell A2 = 69
Cell A3 = No Return


Cell A1 = 134
Cell A2 = 467
Cell A3 = No Return


Sorry to trouble you all but it was my mistake not to explain in
detail...

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
Find a not exact match using vlookup Russ B Excel Discussion (Misc queries) 1 July 27th 05 08:49 PM
find a sum from a list of numbers Keven Excel Worksheet Functions 1 July 21st 05 07:39 PM
Find last match in vllokup snax500 Excel Discussion (Misc queries) 1 May 4th 05 09:42 PM
how to build a formula to match numbers in 2 columns with the equ. mcdilash Excel Worksheet Functions 1 November 10th 04 05:31 PM
Use MATCH to find position of max in 2D range? Peter B Excel Worksheet Functions 4 October 28th 04 05:23 PM


All times are GMT +1. The time now is 10:34 AM.

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

About Us

"It's about Microsoft Excel"