Excel - ISNA question

Asked By Honkey Lips
22-Jun-07 02:28 AM
Hi there..

I have two sets of data side by side in one worksheet. All the same
fields but one set of data has the more records than the other.

My aims is to display only the records that existing in each set.

I'm pretty crap when it comes to excel and so I'm not sure what kind
of formula I'm looking for here. vlookup? ISNA? MATCH?

I have done this =IF(ISNA(MATCH(M2,B:B, 0)),"NOT", " Found") which
tells me correctly that one is not in the other (and then I did it
again for the other side)

But what I actually just want to see is two sets of data with the same
number of rows.


Can anyone help me out here?
Application.CountA
(1)
ColB.Resize
(1)
Worksheet
(1)
Macros
(1)
MATCH
(1)
ISNA
(1)
FilterUR
(1)
Rows.Count
(1)
  Dave Peterson replied...
22-Jun-07 06:41 AM
Are there duplicates in each column?

If no, then there are a couple of options that I like to do.

column A of sheet2.

Then use data|Filter|advanced filter to eliminate the duplicates and put the
result in column B

Debra Dalgleish explains how to do this last step:
http://www.contextures.com/xladvfilter01.html#FilterUR

Then I delete column A.

Then I use a couple of formulas in column B and C:

=isnumber(match(a2,sheet1!a:a,0))
(in B2)
=isnumber(match(a2,sheet1!b:b,0))
(in c2)

And drag down as far as required.

Then I apply data|filter|autofilter on those 3 columns.

Filtering to show True in column B and then True in column C shows me the items
in both lists.  I can filter to show False/True or True/false and see what items
are missing from the opposite list.


previous posts:

Option Explicit
Sub testme()

Application.ScreenUpdating = False

Dim wks As Worksheet
Dim ColA As Range
Dim ColB As Range
Dim iRow As Long
Dim myCols As Long

Set wks = Worksheets("sheet1")
wks.DisplayPageBreaks = False
With wks
'row 1 has headers!
Set ColA = .Range("a2", .Cells(.Rows.Count, "A").End(xlUp))
Set ColB = .Range("b2", .Cells(.Rows.Count, "B").End(xlUp))

With ColA
.Sort key1:=.Cells(1), order1:=xlAscending, header:=xlNo
End With

'change the mycols to the number of columns that
'are associated with column B

myCols = 1 ' columns B only
With ColB.Resize(, myCols)
.Sort key1:=.Cells(1), order1:=xlAscending, header:=xlNo
End With

iRow = 2
Do
If Application.CountA(.Cells(iRow, "A").Resize(1, 2)) = 0 Then
Exit Do
End If

If .Cells(iRow, "A").Value = .Cells(iRow, "B").Value _
Or Application.CountA(.Cells(iRow, "A").Resize(1, 2)) = 1 Then
'do nothing
Else
If .Cells(iRow, "A").Value > .Cells(iRow, "B").Value Then
.Cells(iRow, "A").Insert shift:=xlDown
Else
.Cells(iRow, "B").Resize(1, myCols).Insert shift:=xlDown
End If
End If
iRow = iRow + 1
Loop
End With

Application.ScreenUpdating = True

End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

========
Remember:  Both these techniques are useful if there are no duplicates in each
of the columns.


--

Dave Peterson
  Honkey Lips replied...
24-Jun-07 07:55 PM
Dave...thanks so much for your effort...

that is brilliant..


Willl give it a go now.
Create New Account
help
As Range Dim a As Range Set a = ActiveCell Set c = Columns(a.Column) If Application.CountA(c) = 0 Then MsgBox "Aucune valeur dans cette colonne." Exit Sub End If NL = c As Range Dim a As Range Set a = ActiveCell Set c = Columns(a.Column) If Application.CountA(c) = 0 Then MsgBox "Aucune valeur dans cette colonne." Exit Sub End If NL = c pensez-vous ? A+ Serge Merci Daniel et Denis, Sub Et_Finalement() Set col = ActiveCell.EntireColumn If Application.CountA(col) = 0 Then MsgBox "Colonne vide." Exit Sub End If Set Cellsup = col.Find("*", Cells en "TOUTES" circonstances ! MichD - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - Merci Daniel et Denis, Sub Et_Finalement() Set col = ActiveCell.EntireColumn If Application.CountA(col) = 0 Then MsgBox "Colonne vide." Exit Sub End If Set Cellsup = col.Find("*", Cells
macro else my macro end if Can anybody please help? Excel Programming Discussions Intersect (1) Worksheet (1) Workbook (1) Routine (1) Module (1) Macro (1) TYPE (1) Application (1) if isempty(activecell.offset(1, 0).value) then 'single cell under the activecell or maybe. . . if application counta(activecell.resize(2, 1)) > 0 then 'at least one of the cells (activecell or the as there is insufficient space (only 2 cells available, not 3). So, your code . . . . If Application.CountA(ActiveCell.Resize(2, 1)) > 0 Then . . . . . . should determine if sufficient space is available. Hope this ByVal Sh As Object, ByVal Target As Range) Select Case ActiveCell Case "Type 2" If Application.CountA(ActiveCell.Resize(2, 1)) > 0 Then MsgBox ("Insufficient space") Else Range(ActiveCell.Offset(0, 0 ActiveCell.Offset(1, 0)).Select MsgBox ("OK to continue") End If Case "Type 3" If Application.CountA(ActiveCell.Resize(3, 1)) > 0 Then MsgBox ("Insufficient space") Else Range(ActiveCell.Offset(0
Discussions Sheets (1) Macro (1) VBA (1) Application (1) Range (1) Le (1) bonjour, If Application.CountA(range(cells(Vligne, L), cells(Vligne, R))) = 0 then - - isabelle Le 2011-09-21 10 Feuil1 derlg = .Cells.Find("*", , , , xlByRows, xlPrevious).Row For i = derlg To 2 Step -1 If Application.CountA(.Range(Cells(i, 12), Cells(i, 18))) = 0 Then .Rows(i).Hidden = True End If sait écrire correctement Il y a des points qui se sont perdus ;o)) Remplacer If Application.CountA(.Range(Cells(i, 12), .Cells(i, 18))) = 0 Then par If Application.CountA(.Range(.Cells(i, 12), .Cells(i, 18))) = 0 Then - - Salutations JJ peranza.aioe.org. . . ) = 3D
résultat est une erreur Merci pour votre aide Cdl Infogroup Excel - French Discussions Excel (1) Application.CountA (1) Rows.Count (1) Cordialement (1) Compteur (1) Essais (1) Range("A3").Formula = " = COUNTA(C7 inutile If C.Interior.ColorIndex = 8 Then Compteur = Compteur + 1 End If Next Range("A3") = Application.CountA(Range("C7:C" & Y1)) & " dont " & _ Application.CountA(Range("B7:B" & Y1)) & " en répertoire et " & _ Application.CountA(Range("F7:F" & Y1)) - Compteur & " en classeur." End Sub '- -- -- -- -- -- -- -- -- -- -- -- - - Salutations JJ Ben si tu changes
Excel I want to change this from the Master sheet to the active sheet MyConstant = Application.CountA(Sheets("Master").Range("A2:I31")) Excel Programming Discussions ActiveSheeteg.MyConstant (1) Sheets (1) Excel (1) Application.CountA (1) ActiveSheet.Range (1) ActiveSheet (1) MyConstant (1) Lars (1) Try this. . . MyConstant Application.CountA(ActiveSheet.Range("A2:I31")) - - Rick (MVP - Excel) Try this: MyConstant = Application.CountA(ActiveSheet.Range("A2:I31")) Hope this helps / Lars-?ke Replace Sheets("Master") with ActiveSheet eg