I have a bunch of excel files that contain item "A and B" in column K on many rows, the value in column M on these rows are something like "200"/JOINT"
I need to add up the total number from these rows.
So do I have to remove the inch mark " and the text "/JOINT" first before I can use these numbers in a math equation ?
I need to add up the total number from these rows.
So do I have to remove the inch mark " and the text "/JOINT" first before I can use these numbers in a math equation ?
VBA Code:
sr = 2
lr4 As Long
lrNew As Long
Set rng2 = Range("A1").CurrentRegion
lrNew = rng2.Cells(Rows.Count, "M").End(3).Row
If rng2.Cells(lr4, "M").Value Like "/JOINT" Then
With Range("M1", Cells(Rows.Count, "M").End(3))
.Replace What:="""", Replacement:=vbNullString, LookAt:=xlPart 'REMOVE THE INCH MARK
.Replace What:="/JOINT", Replacement:=vbNullString, LookAt:=xlPart ' REMOVE /JOINT
End With
End If
n = WorksheetFunction.SumIfs(Range("M" & sr & ":M" & lr), Range("K" & sr & ":K" & lr), "*A and B*")