Hi Barry,
I have found that complicated formulae in Excel are
best replaced by a Function. It will be much easier
to understand and modify.
For example, the formula:
=lagrange(xA,f_x1,xB,f_x2,xC,f_x3)
where the parameters are either named values
or CellAddreses, invokes the macro,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Function Lagrange(x As Double, _
x1 As Double, y1 As Double, _
x2 As Double, y2 As Double, _
x3 As Double, y3 As Double) As Double
Dim y, fx1, fx2, fx3 As Double
On Error GoTo MyErr
' f(x)=
' f(x1).((x-x2).(x-x3))/((x1-x2).(x1-x3))
' + f(x2).((x-x1).(x-x3))/((x2-x1).(x2-x3))
' + f(x3).((x-x1).(x-x2))/((x3-x1).(x3-x2))
fx1 = x1 * ((x - x2) * (x - x3)) / ((x1 - x2) * (x1 - x3))
fx2 = x2 * ((x - x1) * (x - x3)) / ((x2 - x1) * (x2 - x3))
fx3 = x3 * ((x - x1) * (x - x2)) / ((x3 - x1) * (x3 - x2))
y = fx1 + fx2 + fx3
Lagrange = y
MyExit:
Exit Function
MyErr:
MsgBox "Err = " & Err & vbCrLf & Err.Description
Resume MyExit
Resume
End Function
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
which is a lot easier to design and debug(if necessary).
Hope that helps.
Regards, Clive.
--- In MS_Access_Professionals@yahoogroups.com, Barry White <imtigerwords@...> wrote:
>
> Yep an excel sheet, that is what I am talking about.
> Â
> I already email my excel users group too regarding this but have not heard back.
> Â
> Eric Lutz
>
>
> ________________________________
> From: Bill Mosca <wrmosca@...>
> To: MS_Access_Professionals@yahoogroups.com
> Sent: Thursday, September 29, 2011 4:21 PM
> Subject: Re: [MS_AccessPros] off topic, IF FORMULA with AND, and OR combined
>
>
> Â
> Eric
>
> This method isn't making any sense to me if this is a table. You say "cell". Are you talking about an excel sheet?
>
> Regards,
> Bill Mosca, Founder - MS_Access_Professionals
> http://www.thatlldoit.com
> Microsoft Office Access MVP
> https://mvp.support.microsoft.com/profile/Bill.Mosca
>
> --- In MS_Access_Professionals@yahoogroups.com, Barry White <imtigerwords@> wrote:
> >
> > Hello all,
> >
> > I have a row of numbers, say:
> >
> > Â B C D E F G H I
> > 1 112 83 126 94 98 110 67 89
> > 2 Â Â start formula in cell D2 Â Â Â Â Â
> > Â
> > In each cell, for three consecutive cells, I wish to test two conditions, so that in cell D2, the start of my formula, I am testing each cell B1, C1, and D1 for the two conditions that follow:
> > Â
> > IF cell B1 is less than 95 OR greater than 110 AND
> > cell C1 is also less than 95 OR greater than 110 AND
> > cell D1 is also less than 95 OR greater than 110, put "Y" for YES or "N" for NO.
> > Â
> > So this same logical statement would apply as in E2, however, it would test for the two conditions mentioned above (<95 OR >110) on cells C1, D1, and E1. Cell F2 would test for the same conditions but on/for cells D1, E1, and F1, etc
> > Â
> > What is the syntax for this? I know the correct logic in terms of words, but I cannot get this syntax to work.
> > Â
> > Please help, and Thank you in advance for everyone's contribution.
> > Â
> > Eric Lutz
> >
> > [Non-text portions of this message have been removed]
> >
>
>
>
>
> [Non-text portions of this message have been removed]
>
Jumat, 30 September 2011
Re: [MS_AccessPros] off topic, IF FORMULA with AND, and OR combined
__._,_.___
MARKETPLACE
.
__,_._,___
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar