View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 1,726
Default any UDF for sum or rounded product

It already is dynamic, it uses two ranges, which you van define to any
cells, as long as they are the same size.

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"dribler2" wrote in message
...
Thanks,
i tried it and the color red was gone, yet when i try to place it in a
large
sheet, where the column data varies, the sumproduct was stock to the first
three data factors only...Maybe you can make it on a dynamic variable
range - for magic's sake.

waiting for your instruction.
dribler2

"Bob Phillips" wrote:

The newsgroup reader has subverted it onto 2 lines, it should just be
one.

Try this variation of that line

mySP = Application.Caller.Parent.Evaluate("SUMPRODUCT(" & _
"ROUND(A1:A3*B1:B3," &dec & "))")

this REALLY is 2 lines.


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"dribler2" wrote in message
...
Bob,

in VB, this line goes in red...i'm not good at correcting this..

mySP =
Application.Caller.Parent.Evaluate("SUMPRODUCT(ROU ND(A1:A3*B1:B3,"
&
dec & "))")

thanks


"Bob Phillips" wrote:

Have you tried it?

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"dribler2" wrote in message
...
hello,

from my previous unsolved post "need sumproduct", please try to
evaluate
this basic scenario

Still unknown,

From below new sample (e.g) i had tried the three(3) suggested
formula.

[col A] [col B] [(An*Bn) = rounded product in 2decimals]

[$ 1.233 ] [ 33.22 ] [ $ 40.96 ]
[$ 0.245 ] [ 11.21 ] [ $ 2.75 ]
[$ 0.122 ] [ -3.215 ] [ $ -0.39 ]

from the above sample the sum of the product (2 decimals) = $43.32
(in
thousands...)

=ROUND(SUMPRODUCT(A1:A3,B1:B3),2) result is [$43.31 < $43.32]

=SUMPRODUCT(ROUND(A1:A3,2),ROUND(B1:B3,2)) result is [$43.2767 <
$43.32]

=ROUND(SUMPRODUCT(ROUND(A1:A3,2),ROUND(B1:B3,2)),2 ) result is
[$43.28
<
$43.32]

(e.g) when you see some invoice or pay receipts, the product from
two
factors are rounded off to 2 decimals. Such rounded product are
summed
below
for the total. Such total is considered correct and is not disputed
by
visual
check of accountants.

Now, the single formula I need is to do the work of totalling the
rounded
product, [ not to round the sum of the virgin products ]

I hope I make it clear that this question is not to lead any dispute
on
round formula may-be errors on few decimals of factors.

thanks for your helping reply