if statement help

A

Adam

Looks like this

Adam 1
Smith 2
Johns 6
adam 3
smith 4
johns 7

What i would like to do is if
Adam matches another adam in list then it adds the 2 together
so in this case adam would = 4
 
D

Dave Peterson

Maybe you can add headers to your data
Then sort that data by the Name
and do Data|Subtotals

And hide the details using the outlining symbols at the left.

===
You may want to spend some time learning about data|pivottable, too.
 
B

Billy Liddel

or you could use something like this

=SUMPRODUCT(--(UPPER($A$2:$A$7)=UPPER(A2))*$B$2:$B$7)

If you wanted to get a list of unique names and do not mind using a macro
try this

Sub UniqueList2()
'place activecell in list
Cells(1, 2).Select
addr = ActiveCell.Address
Set rng = Application.InputBox("Enter the range", "DataRange", addr, 100,
100, , , 8)
' details for unique list range
r = ActiveCell.Row: startR = r
'enter results in blank columns
col = ActiveCell.CurrentRegion.Columns.count + 2
'loop
For Each c In rng
Set lst = Range(Cells(startR, col), Cells(r, col))
x = Application.Match(c, lst, 0)
If IsError(x) Then
Cells(r, col) = c
r = r + 1
End If
Next
End Sub

But Daves, Subtotals idea is good.

Regards
Peter
 
A

Adam

thanks
Dave Peterson said:
Maybe you can add headers to your data
Then sort that data by the Name
and do Data|Subtotals

And hide the details using the outlining symbols at the left.

===
You may want to spend some time learning about data|pivottable, too.
 
Top