Show 3digits under Pairs

wd8ekd

Board Regular
Joined
Sep 12, 2008
Messages
64
A B C D E F
<table style="border-collapse: collapse; width: 387pt;" border="0" cellpadding="0" cellspacing="0" width="515"><col style="width: 54pt;" span="2" width="72"> <col style="width: 35pt;" width="46"> <col style="width: 41pt;" width="54"> <col style="width: 41pt;" width="55"> <col style="width: 54pt;" span="3" width="72"> <tbody><tr style="height: 14.25pt;" height="19"> <td style="height: 14.25pt; width: 54pt;" height="19" width="72">1
</td> <td style="width: 54pt;" width="72">
</td> <td style="width: 35pt;" width="46">
</td> <td class="xl64" style="width: 41pt;" align="right" width="54">12</td> <td class="xl63" style="width: 41pt;" align="right" width="55">66</td> <td class="xl64" style="width: 54pt;" align="right" width="72">18</td> <td style="width: 54pt;" width="72">
</td> <td style="width: 54pt;" width="72">
</td> </tr> <tr style="height: 14.25pt;" height="19"> <td style="height: 14.25pt;" align="right" height="19">456</td> <td align="right">123</td> <td>
</td> <td align="right">129</td> <td align="right">667</td> <td align="right">481</td> <td>
</td> <td>
</td> </tr> <tr style="height: 14.25pt;" height="19"> <td style="height: 14.25pt;" align="right" height="19">667</td> <td align="right">234</td> <td>
</td> <td align="right">123</td> <td align="right">366</td> <td align="right">881</td> <td>
</td> <td>
</td> </tr> <tr style="height: 14.25pt;" height="19"> <td style="height: 14.25pt;" align="right" height="19">129</td> <td align="right">112</td> <td>
</td> <td align="right">112</td> <td>
</td> <td class="xl65"> 018
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 14.25pt;" height="19"> <td style="height: 14.25pt;" align="right" height="19">119</td> <td align="right">312</td> <td>
</td> <td align="right">312</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 14.25pt;" height="19"> <td style="height: 14.25pt;" align="right" height="19">222</td> <td align="right">113</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 14.25pt;" height="19"> <td style="height: 14.25pt;" align="right" height="19">354</td> <td align="right">223</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 14.25pt;" height="19"> <td style="height: 14.25pt;" align="right" height="19">690</td> <td align="right">567</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 14.25pt;" height="19"> <td style="height: 14.25pt;" align="right" height="19">980</td> <td align="right">366</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 14.25pt;" height="19"> <td style="height: 14.25pt;" align="right" height="19"> 481</td> <td class="xl65"> 018
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 14.25pt;" height="19"> <td style="height: 14.25pt;" align="right" height="19">433</td> <td align="right">881</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 14.25pt;" height="19"> <td style="height: 14.25pt;" height="19">
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 14.25pt;" height="19"> <td style="height: 14.25pt;" height="19">
</td> <td colspan="7" style="">Need formula ??? We have a pair of numbers in D1,E1,and F1…..</td> </tr> <tr style="height: 14.25pt;" height="19"> <td style="height: 14.25pt;" height="19">
</td> <td colspan="7" style="">We want only the numbers that have 12 from column A and B</td> </tr> <tr style="height: 14.25pt;" height="19"> <td style="height: 14.25pt;" height="19">
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td colspan="3" style="">66 from column A and B</td> </tr> <tr style="height: 14.25pt;" height="19"> <td style="height: 14.25pt;" height="19">
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td colspan="3" style="">18 from column A and B only</td> </tr> <tr style="height: 14.25pt;" height="19"> <td style="height: 14.25pt;" height="19">
</td> <td colspan="3" style="">Hope I explained it right…..</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 14.25pt;" height="19"> <td style="height: 14.25pt;" height="19">
</td> <td colspan="2" style="">Thank You</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 14.25pt;" height="19"> <td style="height: 14.25pt;" height="19">
</td> <td>Bob</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> <td>
</td> </tr> </tbody></table>
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Trying to send attached file of it to you..How do I send the file ????

Sorry about that...
 
Upvote 0
my fault

Rich (BB code):
Option Explicit

Sub matchnums()
Dim firstlookup  As String
Dim Secondlookup As String
Dim thirdlookup  As String
Dim Item As Range
'clears last data
Sheets("Sheet1").Range("D2", Sheets("Sheet1").Range("F65000")).ClearContents
'reads the three column headers - These can be changed on the sheet if required
firstlookup = Sheets("Sheet1").Range("D1").Value
Secondlookup = Sheets("Sheet1").Range("E1").Value
thirdlookup = Sheets("Sheet1").Range("F1").Value
'loops through each cell in columns A & B
For Each Item In Sheets("Sheet1").Range("A1", Sheets("Sheet1").Range("B65000").End(xlUp))
    If InStr(Item.Value, Left(firstlookup, 1)) Then
        If InStr(Item.Value, Right(firstlookup, 1)) Then
            Sheets("sheet1").Range("D65000").End(xlUp).Offset(1) = Item.Value
            
        End If
    End If
    If InStr(Item.Value, Left(Secondlookup, 1)) Then
        If InStr(Item.Value, Right(Secondlookup, 1)) Then
            Sheets("sheet1").Range("E65000").End(xlUp).Offset(1) = Item.Value
        End If
    End If
    If InStr(Item.Value, Left(thirdlookup, 1)) Then
        If InStr(Item.Value, Right(thirdlookup, 1)) Then
            Sheets("sheet1").Range("F65000").End(xlUp).Offset(1) = Item.Value
        End If
    End If
Next Item
End Sub
 
Upvote 0
NOTE:

Column A cannot contain more numbers than column B.

Does this cause a problem??
 
Upvote 0
It did the trick for awhile.......It does not work on doubles and
also on front zero's.......
 
Upvote 0
The lead zero can be fixed by changing the all relavent columns to text rather than numbers.

Just highlight the cells (I did A,B,D,E&F) click
FORMAT > CELLS > Then Select TEXT > OK


Can you give me an example of a double??

1616 worked for me
 
Upvote 0
Improved code
now can have different number of figures in A & B
Code:
Option Explicit
Sub matchnums()
Dim firstlookup  As String
Dim Secondlookup As String
Dim thirdlookup  As String
Dim Item As Range
'clears last data
Sheets("Sheet1").Range("D2", Sheets("Sheet1").Range("F65000")).ClearContents
'reads the three column headers - These can be changed on the sheet if required
firstlookup = Sheets("Sheet1").Range("D1").Value
Secondlookup = Sheets("Sheet1").Range("E1").Value
thirdlookup = Sheets("Sheet1").Range("F1").Value
'loops through each cell in columns A
For Each Item In Sheets("Sheet1").Range("A1", Sheets("Sheet1").Range("A65000").End(xlUp))
    If InStr(Item.Value, Left(firstlookup, 1)) Then
        If InStr(Item.Value, Right(firstlookup, 1)) Then
            Sheets("sheet1").Range("D65000").End(xlUp).Offset(1) = Item.Value
            
        End If
    End If
    If InStr(Item.Value, Left(Secondlookup, 1)) Then
        If InStr(Item.Value, Right(Secondlookup, 1)) Then
            Sheets("sheet1").Range("E65000").End(xlUp).Offset(1) = Item.Value
        End If
    End If
    If InStr(Item.Value, Left(thirdlookup, 1)) Then
        If InStr(Item.Value, Right(thirdlookup, 1)) Then
            Sheets("sheet1").Range("F65000").End(xlUp).Offset(1) = Item.Value
        End If
    End If
Next Item
'loops through each cell in columns B
For Each Item In Sheets("Sheet1").Range("B1", Sheets("Sheet1").Range("B65000").End(xlUp))
    If InStr(Item.Value, Left(firstlookup, 1)) Then
        If InStr(Item.Value, Right(firstlookup, 1)) Then
            Sheets("sheet1").Range("D65000").End(xlUp).Offset(1) = Item.Value
            
        End If
    End If
    If InStr(Item.Value, Left(Secondlookup, 1)) Then
        If InStr(Item.Value, Right(Secondlookup, 1)) Then
            Sheets("sheet1").Range("E65000").End(xlUp).Offset(1) = Item.Value
        End If
    End If
    If InStr(Item.Value, Left(thirdlookup, 1)) Then
        If InStr(Item.Value, Right(thirdlookup, 1)) Then
            Sheets("sheet1").Range("F65000").End(xlUp).Offset(1) = Item.Value
        End If
    End If
Next Item
 
Upvote 0

Forum statistics

Threads
1,214,829
Messages
6,121,827
Members
449,051
Latest member
excelquestion515

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top