sum "like"?

  • Thread starter Thread starter Pablo
  • Start date Start date
P

Pablo

Is there a function or array that can sum anything like "001-"?

For example, I have a list of #s such as:

001-001
001-004
002-001
001-005
004-001

in a column, and the next column list values such as:

$5
$7
$9
$10
$3

How can I sum everything that is like "001-"? So sum 001-001, 001-004, and
001-005?

Thanks!
 
Hi Pablo,

This is not a straight forward thing.
But I hope this helps. Do you now Visual Basic program.

Sub Sample()
Dim XXX As String
Do Until IsEmpty(Range("A" & curRow + 1).Value)
curRow = curRow + 1
Range("A" & curRow).Select
For Each CurCell In Selection
If Left(CurCell.Value, 3) = "001" Then
MsgBox "OK"
Else
MsgBox "Not OK"
End If
Next
Loop
End Sub

If you put all the numbers 001-001 etc. in A column then run the macro above.
It will prompt you with Ok and Not Ok all you need to do is figure it out
what cell
you gonna put on the Ok and Not Ok corresponding to the number to be added.

Hope it helps a bit.
 
Back
Top