Excel Question

Discussion in 'Horn Depot' started by LongIslandIceSIP, Aug 16, 2007.

  1. LongIslandIceSIP

    LongIslandIceSIP 500+ Posts

    Say you have a bunch of data on column A. You have a different data set on column B.

    What formula do I use to have Excel look through each entry in column A, see if it's also in column B, and if it's not, dump a copy of the value into column C?

    This would give me a list off all values in column A that are NOT also in column B.

    Thanks

    [​IMG]
     
  2. JimBeam

    JimBeam 25+ Posts

    run a query in Access
     
  3. LosIllini

    LosIllini 250+ Posts

    Here's a simple match formula that may wwork for you.

    Link
     
  4. po elvis

    po elvis 250+ Posts

    Here is a simple macro I use:

    Sub compare()
    Dim ColumnA As Range
    Dim ColumnB As Range
    Dim ColumnC As Range

    Set ColumnC = Range("c4")

    Set ColumnA = Range("a4")
    Do Until ColumnA = ""

    Repeat:
    Set ColumnB = Range("b4")

    Do Until ColumnB = ""
    If ColumnB = ColumnA Then
    Set ColumnA = ColumnA.Offset(1, 0)
    GoTo Repeat
    End If
    Set ColumnB = ColumnB.Offset(1, 0)
    Loop
    ColumnC.Value = ColumnA.Value
    Set ColumnC = ColumnC.Offset(1, 0)
    Set ColumnA = ColumnA.Offset(1, 0)
    Loop

    End Sub

    It will only work if you have no empty rows. ANd in this macro, I have it if your rows start in row 4. If you want it to start on another row change where you see a "4" in the range to the row you want to start in.
     
  5. LongIslandIceSIP

    LongIslandIceSIP 500+ Posts

    ALLSOME! [​IMG]

    I got it to work. thanks for the help guys!
     
  6. axle hongsnort

    axle hongsnort 250+ Posts

    for next time, i would say a vlookup is quick and easy. shouldn't need a macro for this imo
     

Share This Page