15 digit restriction

While TommyGun is correct that you have the 15 digit limitation for numbers, you do not have this for text, the limit is 1024 or some such number. If you can live with treating your numbers as text, the following UDF will add your numbers up. I haven't got subtraction in the code, but it would probably be pretty easy to check for minus signs at the beginning of the string.
Book13
BCDE
1Format
21234567890123456345Text
31234567890123456Text
41235802458013570000Number
51235802458013579801Text
Sheet1


And here is the UDF. It could probably be cleaned up a little, but it seems to work.
Code:
Function AddText(var1 As String, var2 As String)
Dim len1 As Long, len2 As Long, maxlength As Long, temp As Long
Dim temp1 As Integer, temp2 As Integer, temp3 As Integer
    len1 = Len(var1)
    len2 = Len(var2)
    maxlength = Application.WorksheetFunction.Max(len1, len2)
    AddText = ""
    temp3 = 0
    For i = 1 To maxlength
        If i<= len1 Then
            temp1 = Val(Mid(var1, len1 - i + 1, 1))
        Else
            temp1 = 0
        End If
        If i<= len2 Then
            temp2 = Val(Mid(var2, len2 - i + 1, 1))
        Else
            temp2 = 0
        End If
        temp = temp1 + temp2 + temp3
        If temp > 9 Then
            temp3 = 1
            temp = temp - 10
        Else
            temp3 = 0
        End If
        AddText = CStr(temp) & AddText
    Next i
End Function
 
Upvote 0

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
I started to work on subtraction and it is not as easy as I remembered. I need to worry about borrowing and when I have to borrow and the number I borrow from is a 0, I need to keep checking until I find a non 0 number. It is quite messy now so I will have to take some time to play around with it. I might not get to it until next week.
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,927
Members
449,094
Latest member
teemeren

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