View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bernd P Bernd P is offline
external usenet poster
 
Posts: 806
Default fomula to divide

Hello,

I suggest to use this UDF:
Function cellsumdivision(r1 As Range, r2 As Range) As Double
Dim v1, v2
Dim i As Long, d As Double
With Application.WorksheetFunction
v1 = Split(Mid(r1.Formula, 2, 2048), "+")
v2 = Split(Mid(r2.Formula, 2, 2048), "+")
If UBound(v1) = UBound(v2) Then
For i = LBound(v2) To UBound(v2)
d = d + v1(i) / v2(i)
Next i
cellsumdivision = d
Else
cellsumdivision = CVErr(xlErrValue)
End If
End With
End Function

Press ALT + F11, insert a new macro module, copy macro code into it,
go back to worksheet and then use
=cellsumdivision(A1,A2)

Regards,
Bernd