Excel Hints

Results 1 to 3 of 3

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

  1. #1

    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
    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
      To view attachments your post count must be 0 or greater. Your post count is 0 momentarily.

  3. #3
    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
  •