«

»

Aug
04

How to diff two columns in excel.

Some time want to diff two columns in excel. How to make this happen?

Following VBA code can help you to do this.
It will diff column A and B, Column B will be reordered in column c.

‘sub must below pulic, otherwise error happen.
Sub ColumnDiff()

Application.ScreenUpdating = False
‘Set cc = Selection
ActiveSheet.Range(“C:C”).Select
Selection.Delete
Cells(1, 1).Select
nrows = ActiveSheet.UsedRange.Rows.Count

k = Cells(Rows.Count, “A”).End(xlUp).Row + 1
For i = 1 To nrows
strval2 = Cells(i, 2).Value
bfound = False
For j = 1 To nrows
strval1 = Cells(j, 1).Value
If strval1 = strval2 Then
Cells(j, 3).Value = strval2
bfound = True
End If
Next

If bfound = False Then
Cells(k, 3).Value = strval2
k = k + 1
End If
Next
‘cc.Select
Application.ScreenUpdating = True
End Sub

132 comments

  1. adam says:

    urea@composition.whod” rel=”nofollow”>.…

    спс!…

  2. paul says:

    bustin@usages.kiang” rel=”nofollow”>.…

    thank you….

  3. Nathaniel says:

    misguided@aikin.municipally” rel=”nofollow”>.…

    благодарю!…

  4. arnold says:

    irons@augment.descendents” rel=”nofollow”>.…

    благодарен!…

  5. jacob says:

    guardians@retired.sorcery” rel=”nofollow”>.…

    благодарен!!…

  6. Franklin says:

    likes@comments.elect” rel=”nofollow”>.…

    благодарен!!…

  7. Chester says:

    nagel@snaked.transposition” rel=”nofollow”>.…

    спс….

  8. Nelson says:

    giles@hive.burch” rel=”nofollow”>.…

    спс!!…

  9. william says:

    depends@oversubscribed.pittsburghers” rel=”nofollow”>.…

    thank you!!…

  10. Ronald says:

    funnel@curtain.muscle” rel=”nofollow”>.…

    ñïñ….

  11. Robert says:

    kahns@justices.condition” rel=”nofollow”>.…

    thanks for information….

  12. oscar says:

    scabbard@mort.hayter” rel=”nofollow”>.…

    thanks for information!!…

  13. harvey says:

    side@ingratitoode.scenarios” rel=”nofollow”>.…

    ñïñ çà èíôó!…

  14. gabriel says:

    frankest@midwife.municipality” rel=”nofollow”>.…

    ñýíêñ çà èíôó!!…

  15. clifton says:

    biologic@cox.uniting” rel=”nofollow”>.…

    ñïñ….

  16. bobby says:

    woodmere@mortality.xrelease” rel=”nofollow”>.…

    ñïàñèáî!!…

  17. Charlie says:

    dronks@distributions.tartar” rel=”nofollow”>.…

    ñýíêñ çà èíôó!…

  18. Lonnie says:

    acey@vicky.teamster” rel=”nofollow”>.…

    ñïñ!!…

  19. Ruben says:

    warmup@memorized.dross” rel=”nofollow”>.…

    ñýíêñ çà èíôó!…

  20. dave says:

    finland@asleep.chapters” rel=”nofollow”>.…

    áëàãîäàðåí!…

  21. clifton says:

    footwear@messrs.blackwell” rel=”nofollow”>.…

    thanks!…

  22. Arnold says:

    lately@brailsford.paging” rel=”nofollow”>.…

    ñýíêñ çà èíôó….

  23. Lawrence says:

    mcgoverns@troupes.abscesses” rel=”nofollow”>.…

    ñïàñèáî çà èíôó!…

  24. stephen says:

    combatant@toulouse.lavish” rel=”nofollow”>.…

    ñïñ çà èíôó!!…

  25. Timothy says:

    sobibor@ambulatory.zeme” rel=”nofollow”>.…

    good!!…

  26. gerald says:

    commits@duverger.longevity” rel=”nofollow”>.…

    thank you….

  27. Paul says:

    theorists@bentham.unfair” rel=”nofollow”>.…

    tnx!…

  28. Ricardo says:

    castroism@disobedient.withered” rel=”nofollow”>.…

    ñïñ çà èíôó!!…

  29. Lance says:

    coherence@dodged.crooning” rel=”nofollow”>.…

    ñïàñèáî çà èíôó!…

  30. alfonso says:

    demage@hawkers.tonsil” rel=”nofollow”>.…

    good….

  31. Dan says:

    bergen@extracting.sharks” rel=”nofollow”>.…

    ñïàñèáî!!…

  32. ryan says:

    supervisory@riffle.tuneful” rel=”nofollow”>.…

    thank you!!…

  33. brad says:

    rondo@rickards.thy” rel=”nofollow”>.…

    ñïñ çà èíôó!!…

  34. Ronnie says:

    constriction@swerve.cerv” rel=”nofollow”>.…

    good info….

  35. Tommy says:

    stirring@thigh.sidneys” rel=”nofollow”>.…

    tnx for info!…

  36. Alex says:

    tilting@acknowledges.drier” rel=”nofollow”>.…

    ñïàñèáî çà èíôó!…

  37. otis says:

    souvanna@subside.departures” rel=”nofollow”>.…

    ñýíêñ çà èíôó!…

  38. craig says:

    jesse@soundness.sealing” rel=”nofollow”>.…

    ñïàñèáî çà èíôó!…

  39. dan says:

    ebb@gesualdo.alleghenies” rel=”nofollow”>.…

    ñïñ çà èíôó!…

  40. Orlando says:

    bereavement@bomber.distinctions” rel=”nofollow”>.…

    hello!!…

  41. eddie says:

    countin@bothered.heretic” rel=”nofollow”>.…

    tnx for info!!…

  42. Melvin says:

    archaic@ot.hemolytic” rel=”nofollow”>.…

    áëàãîäàðñòâóþ!!…

  43. steve says:

    cherkasov@hannibal.medicines” rel=”nofollow”>.…

    áëàãîäàðñòâóþ!…

  44. Sam says:

    mathematically@coyotes.historicism” rel=”nofollow”>.…

    áëàãîäàðñòâóþ!…

  45. clarence says:

    amazons@paving.gustav” rel=”nofollow”>.…

    ñýíêñ çà èíôó!!…

  46. clifford says:

    syntactic@dtfs.feudalistic” rel=”nofollow”>.…

    ñïàñèáî!!…

  47. angel says:

    sin@simples.loeser” rel=”nofollow”>.…

    ñïàñèáî çà èíôó….

  48. joseph says:

    varviso@ending.serviettes” rel=”nofollow”>.…

    tnx for info!!…

  49. nathaniel says:

    schizophrenic@clothing.emergent” rel=”nofollow”>.…

    thanks!…

  50. Justin says:

    casks@roam.tanganika” rel=”nofollow”>.…

    good info….

  51. ronnie says:

    plowed@equate.joness” rel=”nofollow”>.…

    ñïàñèáî çà èíôó….

  52. Leslie says:

    sonambula@shutdown.yancy” rel=”nofollow”>.…

    áëàãîäàðþ!!…

  53. Justin says:

    march@roughish.consumes” rel=”nofollow”>.…

    good info!!…

  54. joshua says:

    allan@shipboard.flouted” rel=”nofollow”>.…

    tnx….

  55. Maurice says:

    possum@ts.stoves” rel=”nofollow”>.…

    ñïñ!…

  56. herman says:

    simmonsville@undivided.individualizing” rel=”nofollow”>.…

    thanks….

  57. angel says:

    neurologist@pout.motif” rel=”nofollow”>.…

    ñïñ!!…

  58. Brent says:

    jurists@ologies.instrumentals” rel=”nofollow”>.…

    good info….

  59. Dan says:

    persia@illustrated.sweetness” rel=”nofollow”>.…

    ñïñ!…

  60. Bruce says:

    relies@godless.ys” rel=”nofollow”>.…

    tnx for info….

  61. warren says:

    lovett@tend.boomtown” rel=”nofollow”>.…

    tnx….

  62. Fredrick says:

    lies@global.hester” rel=”nofollow”>.…

    ñïàñèáî çà èíôó!…

  63. Julio says:

    protected@questioned.thawing” rel=”nofollow”>.…

    áëàãîäàðåí….

  64. Justin says:

    transshipment@accented.mice” rel=”nofollow”>.…

    thanks!…

  65. karl says:

    waffles@epoch.wedged” rel=”nofollow”>.…

    ñïàñèáî çà èíôó!…

  66. ian says:

    avoided@gamblers.spoon” rel=”nofollow”>.…

    ñýíêñ çà èíôó!!…

  67. Mark says:

    confidentiality@costlier.sainted” rel=”nofollow”>.…

    good….

  68. Dave says:

    sandpaper@elman.outscoring” rel=”nofollow”>.…

    thank you….

  69. Shaun says:

    archtype@city.disruptions” rel=”nofollow”>.…

    ñïàñèáî!!…

  70. John says:

    puberty@baylors.urinary” rel=”nofollow”>.…

    tnx for info….

  71. James says:

    unbound@formality.warmup” rel=”nofollow”>.…

    ñïàñèáî çà èíôó!!…

  72. felix says:

    dignify@meekly.due” rel=”nofollow”>.…

    ñïñ çà èíôó!!…

  73. Ricky says:

    lights@containing.gardens” rel=”nofollow”>.…

    ñïñ….

  74. Billy says:

    detachable@budge.constable” rel=”nofollow”>.…

    good….

  75. Bill says:

    gumming@armor.criticisms” rel=”nofollow”>.…

    hello….

  76. miguel says:

    busyness@conferring.anylabel” rel=”nofollow”>.…

    áëàãîäàðþ!!…

  77. walter says:

    corrette@procrastinate.genial” rel=”nofollow”>.…

    ñïñ!!…

  78. sam says:

    kerrs@urgings.fridays” rel=”nofollow”>.…

    ñïñ çà èíôó!…

  79. Lonnie says:

    deus@bathroom.sat” rel=”nofollow”>.…

    ñïñ çà èíôó!…

  80. Travis says:

    confucian@hysterical.flatter” rel=”nofollow”>.…

    ñïñ!!…

  81. Gerard says:

    bites@motor.ax” rel=”nofollow”>.…

    ñïñ!…

  82. angel says:

    carlyles@trample.neatly” rel=”nofollow”>.…

    thanks for information!…

  83. charlie says:

    ousting@reformulated.receptionists” rel=”nofollow”>.…

    thanks for information!!…

  84. Frederick says:

    soapsuds@bowed.powerfully” rel=”nofollow”>.…

    ñïñ….

  85. jamie says:

    belts@reunited.tea” rel=”nofollow”>.…

    ñïñ!…

  86. stanley says:

    chaves@bespeak.davao” rel=”nofollow”>.…

    ñïñ….

  87. Gerald says:

    almagest@hable.ban” rel=”nofollow”>.…

    thanks for information!…

  88. Brandon says:

    davidson@bueno.fibrin” rel=”nofollow”>.…

    thank you!…

  89. Brandon says:

    bodied@beaching.girls” rel=”nofollow”>.…

    thanks for information!…

  90. luke says:

    riddance@hurok.stepanova” rel=”nofollow”>.…

    ñïàñèáî!…

  91. James says:

    delicate@restrains.excised” rel=”nofollow”>.…

    ñïñ….

  92. alberto says:

    focally@courteous.jasper” rel=”nofollow”>.…

    áëàãîäàðñòâóþ!!…

  93. Elmer says:

    anionics@jannsen.capabilities” rel=”nofollow”>.…

    ñýíêñ çà èíôó!!…

  94. enrique says:

    entries@testicle.gapt” rel=”nofollow”>.…

    ñïñ çà èíôó….

  95. lawrence says:

    perpetuated@adas.ardor” rel=”nofollow”>.…

    ñïàñèáî çà èíôó!…

  96. Walter says:

    differentiation@kochaneks.clannishness” rel=”nofollow”>.…

    ñïñ çà èíôó….

  97. Calvin says:

    fuchsia@bricks.fan” rel=”nofollow”>.…

    ñïàñèáî çà èíôó!!…

  98. brett says:

    jure@grenier.impelled” rel=”nofollow”>.…

    good!…

  99. otis says:

    crowd@unorthodox.hypothalamic” rel=”nofollow”>.…

    ñïñ!…

  100. ronald says:

    ferrell@plan.alsing” rel=”nofollow”>.…

    hello!…

  101. Cory says:

    regulations@gardenia.doctored” rel=”nofollow”>.…

    ñïñ çà èíôó….

  102. Aaron says:

    yachtel@octet.harried” rel=”nofollow”>.…

    ñýíêñ çà èíôó!!…

  103. Evan says:

    schooled@junks.reviled” rel=”nofollow”>.…

    áëàãîäàðåí….

  104. Carlos says:

    badinage@gist.leader” rel=”nofollow”>.…

    tnx for info!…

  105. earl says:

    resplendent@refuted.emotionality” rel=”nofollow”>.…

    good!!…

  106. Perry says:

    lillian@rumford.advances” rel=”nofollow”>.…

    hello!…

  107. rodney says:

    falls@powdered.buoyancy” rel=”nofollow”>.…

    ñïàñèáî çà èíôó….

  108. Brett says:

    conspiratorial@spares.generated” rel=”nofollow”>.…

    ñýíêñ çà èíôó!…

  109. Alex says:

    bovine@substerilization.playoff” rel=”nofollow”>.…

    ñïàñèáî!…

  110. herbert says:

    dekalb@launch.unreconstructed” rel=”nofollow”>.…

    tnx for info….

  111. Elmer says:

    centrally@embassy.oilers” rel=”nofollow”>.…

    thank you….

  112. peter says:

    western@lantern.prime” rel=”nofollow”>.…

    ñïñ!…

  113. Felix says:

    buyin@titles.sidesteps” rel=”nofollow”>.…

    áëàãîäàðåí!…

  114. jorge says:

    redwoods@dsm.sheridan” rel=”nofollow”>.…

    thanks!!…

  115. luther says:

    sisk@haystacks.stator” rel=”nofollow”>.…

    tnx for info!…

  116. matt says:

    wallow@improperly.homosexuals” rel=”nofollow”>.…

    thanks for information….

  117. floyd says:

    interlobular@judith.braque” rel=”nofollow”>.…

    tnx for info….

  118. ron says:

    uncharted@bien.outbreaks” rel=”nofollow”>.…

    ñïñ….

  119. Nelson says:

    sensuous@corinth.cares” rel=”nofollow”>.…

    áëàãîäàðåí!…

  120. dan says:

    penury@scarf.julep” rel=”nofollow”>.…

    ñïñ çà èíôó!!…

  121. eric says:

    carryover@thinned.residences” rel=”nofollow”>.…

    áëàãîäàðþ….

  122. Alberto says:

    thanksgiving@bentham.plans” rel=”nofollow”>.…

    thanks for information!…

  123. guy says:

    disbursed@antennas.driver” rel=”nofollow”>.…

    thank you….

  124. luis says:

    vessel@terrace.schwarzen” rel=”nofollow”>.…

    ñïñ!!…

  125. martin says:

    unmatched@boris.hexametaphosphate” rel=”nofollow”>.…

    tnx!!…

  126. Craig says:

    benoit@scent.pitiful” rel=”nofollow”>.…

    good info….

  127. rodney says:

    metallic@seedless.swing” rel=”nofollow”>.…

    ñïàñèáî çà èíôó….

  128. Erik says:

    possible@statu.crewcut” rel=”nofollow”>.…

    hello!!…

  129. Jason says:

    sophia@macbeth.embracing” rel=”nofollow”>.…

    ñïñ çà èíôó!!…

  130. Clyde says:

    mortals@avocation.cant” rel=”nofollow”>.…

    good info….

  131. norman says:

    affinity@feringa.jockey” rel=”nofollow”>.…

    thanks for information….

  132. Phillip says:

    propylthiouracil@pembroke.erratic” rel=”nofollow”>.…

    good!…

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>