Consulting

Results 1 to 3 of 3

Thread: Solved: Sum 'A' if there's any digit into string in 'B'

  1. #1
    VBAX Regular
    Joined
    Aug 2011
    Posts
    87
    Location

    Solved: Sum 'A' if there's any digit into string in 'B'

    Hi all.

    .A......... B
    10.....123 ab
    20.....123ab
    30.....ab 123
    40.....ab123
    50.....123
    60.....ab

    I need to sum values from column 'A' if same row in 'B' there's some digit.
    So, in e.g. above the result would be 10+20+30+40+50=150

    Thanks in advance.
    Regards
    Osvaldo

  2. #2
    VBAX Regular
    Joined
    Nov 2011
    Location
    Ufa
    Posts
    75
    Location
    UDF
    [vba]Function NumStr#(rSum As Range, rCheck As Range)
    Dim i&, smm#
    If rSum.Count <> rCheck.Count Then Exit Function
    For i = 1 To rSum.Count
    If rCheck(i, 1) Like "*[0-9]*" Then smm = smm + rSum(i, 1)
    Next i
    NumStr = smm
    End Function[/vba]
    Attached Files Attached Files

  3. #3
    VBAX Regular
    Joined
    Aug 2011
    Posts
    87
    Location
    Hi nilem.
    Works nicely.
    Thanks for your attention and for your time.
    Regards
    Osvaldo

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •