Maybe I'm getting to old for this... This is my immediate Window in the Excel 2010 VBE. Three numbers: P1=31.53, P2=31.46, P3=31.39
I take the average from P1 and P3 (see above): 31.46 (makes sense).
Then I subtract P2 to get... zero....
P1, P2, P3 are defined as Double. If I define "Av13_2_Dist" as Double too and calculate this:
Av13_2_Dist = Abs((P1 + P3) / 2 - P2)
The outcome is still zero. This always worked fine when I used ranges as input to P1, P2 and P3. Now I move them into a (variant) array first... could that be the cause here? And what can I do about this then? Copy the Variant array into a Double array first?? (the array has to be variant to be able to 'receive' a range)
VBA Calculation mystery
-
- BronzeLounger
- Posts: 1246
- Joined: 03 Feb 2010, 19:59
- Location: Terneuzen, the Netherlands
VBA Calculation mystery
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78493
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
-
- BronzeLounger
- Posts: 1246
- Joined: 03 Feb 2010, 19:59
- Location: Terneuzen, the Netherlands
Re: VBA Calculation mystery
Deeper than I thought... my brain's not working. Looks like an error in my algorithm and not in Excel I think. I'll re-check and if you don't hear back... ignore me