Sum numbers from text&num array?

ljubo_gr

Board Regular
Joined
Dec 6, 2014
Messages
244
Office Version
  1. 2016
Platform
  1. Windows
Hello,
i need help of looking an array of data, please Find {0,1,2,3,4,5,6,7,8,9}, and then Sumproduct.

W50150s768Q737
5564Y325X700065000
K15001200C33002500
1200e700b1001000

<tbody>
</tbody>


Result should be: 91,094 units. Text will mostly be single char letter, always in front, from beginning.
THANKS in advance!
 
heres a UDF

Code:
Function sumranges(ParamArray cellranges() As Variant)
Dim cell As Range, i As Long, area As Variant
For Each area In cellranges
If TypeName(area) = "Range" Then
For Each cell In area
If Asc(UCase(cell)) > 64 And Asc(UCase(cell)) < 91 Then
i = i + (Mid(cell, 2, 256) + 0)
Else
i = i + cell
End If
Next
End If
Next
sumranges = i
End Function

This UDF not working, I also have empty cells, text2017, 2017text,.. and negative numbers like -2017, so this isn0t working, THANKS BarryL!
 
Upvote 0

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Solved, THANKS JohnTopley https://www.excelforum.com/excel-fo...4245-extract-numbers-from-text0000text-3.html

Code:
Function Add_Numeric(iRng As Range) As Long

For Each cell In iRng
    l = Len(cell)
    If l = 0 Then GoTo nextcell
    numstr = ""
    Mf = 1
    If InStr(1, cell, "-") Then Mf = -1
    For i = 1 To l
        If IsNumeric(Mid(cell, i, 1)) Then numstr = numstr & Mid(cell, i, 1)
    Next i
    Add_Numeric = Add_Numeric + numstr * Mf
nextcell:
Next cell

End Function
 
Upvote 0

Forum statistics

Threads
1,215,647
Messages
6,126,006
Members
449,280
Latest member
Miahr

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top