ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   fomula to divide (https://www.excelbanter.com/excel-worksheet-functions/247032-fomula-divide.html)

Ranjith Kurian[_2_]

fomula to divide
 
in cell A1 i hv typed the amounts as follows CellA1=37020+400+2676.8+247009.68
and in cell A2 the rates typed are as follows =7.7519+1+49.3945+1
now i need my CellA2 rates to be divide with CellA1 amounts as per arranged
example

RESULT
37020/7.7519 + 400/1 + 2676.8/49.3945 + 247009.68/1
and the expected result is252239.4757

Is there any formula to dividethe CellA1/CellA2 as per the arranged orders,
with out any manually work


Bernd P

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

Neil M

fomula to divide
 

Could you not simply use the mathematical order of operations in conjunction
with brackets to tell what you wanted to divide first?
If I wanted to divide 20 by 2 then it would simply be =20/2

If I wanted to divide that by 2 again after the first function it would be
=(20/2)/2

I think that would work, wouldnt it?



All times are GMT +1. The time now is 04:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com