Search Column, If match found then add two values.

  • Thread starter Thread starter Scott.L.MacKintosh
  • Start date Start date
S

Scott.L.MacKintosh

Hello all,

Ive found this group extremely useful before, so I thought id ask a
question of my own since I cant find anything to help or come up with
anything that solves it myself.

I have a sheet that lists who watched our online event with the times
theyve logged in and out, sometimes you can have multiple connections
from one person but I want them considered as the same person with the
total viewing shown. I would like to search by the FullName field(The
only unique field I have) and if it finds a match then I want to add
the total time watched values, sometimes the names are way down the
column.

So I want to search D(fullname), If match then add the values from the
cells in the row the match was found but on column L(total time)
together with the original and then delete the duplicate row if
possible.

Any help would be most appreciated

Yours

S MacKintosh
 
Sub SumAndDelete()
Dim c As Range
Dim rng As Range
Dim iEnd As Long
Dim iCt As Long
Dim ws As Worksheet

Set ws = Sheets("Sheet1")
iEnd = ws.Range("D1").End(xlDown).Row
Set rng = ws.Range("D2:D" & iEnd)
For Each c In rng
For iCt = iEnd To c.Row + 1 Step -1
If c = ws.Range("D" & iCt) Then
c.Offset(0, 8) = c.Offset(0, 8) + ws.Range("L" & iCt)
ws.Rows(iCt).Delete
End If
Next iCt
Next c
End Sub

Hth,
Merjet
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top