+ Reply to Thread
Results 1 to 12 of 12

Long equation

  1. #1
    Registered User
    Join Date
    03-15-2007
    Posts
    14

    Long equation

    First question, I am trying to work out a way to write the attached equation into Excel. My maths is not that flash so I am unsure of some of the 'rules' that apply with tan, parenthses, etc.

    \1

    I have the values for the X1 X2 Y1 and Y2, and will substitute the cell ref later on.

    Any help would be appreciated.

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,849
    Not sure what specific questions you might have. It would be easier to help if you had specific questions.

    With a long formula like that, I will do one of two things:
    1) Use several cells to build the formula in stages. For example, I would probably start with four cells dedicated to calculating the tan^-1. One thing I hate when building a large formula in a single cell is debugging it. When you get it together right, it's not a big deal. But when it's wrong (due to a misplaced parenthesis or wrong sign or something), a long formula can be a challenge to debug. When you build the formula over several cells, it can be easier to debug, because the formula is broken down.
    2) Build a VBA UDF. This might be beyond your skill level, but I find this a useful approach sometimes, especially for large formulas that I use frequently. With a VBA UDF, I build and debug the function once. Then I can use it knowing that the formula is being calculated correctly.

    One other note: remember that the arctan function returns an angle in radians. If memory serves correctly, the convention for the arctan function is to return an angle in the 1st or 4th quadrants (-pi/2<=theta<=+pi/2). If, for whatever reason, you need something else, be sure to take that into account.

  3. #3
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    What is the name of that equation, anyway? Have you searched for something like "<equation name> excel vba" or "<equation name> excel user defined function", etc.?

    I'm glad I don't have to do math anymore. Sheesh.

  4. #4
    Registered User
    Join Date
    03-15-2007
    Posts
    14
    Thank you for the replies.

    I was thinking that I would have to write the equation over several cells. Problem is I don't know where to separate it.


    Not sure of the proper name of the equation, but it is used to calculate radiant heat using what is termed "view factor".

    Thank you

  5. #5
    Registered User
    Join Date
    03-15-2007
    Posts
    14
    For instance, this format of the equation displays an error.

    TAN^(-1)(b42/SQRT(1+b40^(2)))

    In the words of Vinnie Barbarino, "I am so confused!"

  6. #6
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,849
    1st get the correct syntax. I know tan^-1 is conventional notation for the arctan function, but Excel doesn't recognize that syntax. I can't remember if Excel uses the ATAN or ARCTAN function for arctan. Search Excel Help for
    "trigonometric functions"

  7. #7
    Registered User
    Join Date
    03-15-2007
    Posts
    14
    =B40/SQRT(1+B40^(2))
    =ATAN(-1)*(B42/SQRT(1+B40^(2)))
    =B42/SQRT(1+B42^(2))
    =ATAN(-1)*(B42/SQRT(1+B40^(2)))
    =B41/SQRT(1+B41^(2))
    =ATAN(-1)*(B42/SQRT(1+B40^(2)))
    =B43/SQRT(1+B43^(2))
    =ATAN(-1)*(B42/SQRT(1+B40^(2)))

    This is what I have now, does it look right?

  8. #8
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,849
    =ATAN(-1)*(B42/SQRT(1+B40^(2)))
    ATAN(-1)=-pi/4, so the above expression =-pi/4*(B42/SQRT((1+B40)^2)). Looking at the equation in your attachment, I don't think that is what you are after. Drop the (-1).

  9. #9
    Registered User
    Join Date
    03-15-2007
    Posts
    14
    Thanks Mr Shorty

  10. #10
    Registered User
    Join Date
    03-15-2007
    Posts
    14
    Do these excel equations look right?

    X1 = (Lf sina-0.5Lfcosatan0-dtan0-h)/(d-0.5Lfcosa)=
    ((B15*SIN(B18)-0.5*B15*COS(B18)*TAN(B19)-B17))/(B20-0.5*B15*COS(B18))

    X2 = (h+(d-0.5Lfcosa)tan0)/(d-0.5Lfcosa)=
    (B17+(B20-0.5*B15*COS(B18))*TAN(B19))/(B20-0.5*B15*COS(B18))

    Y1 = (0.5Wf)/(d-0.5Lfcosa)=(0.5*B16)/(B20-(0.5*B15*COS(B18)))

    Y2 = (0.5Wf)/(d-0.5Lfcosa)=(0.5*B16)/(B20-(0.5*B15*COS(B18)))

  11. #11
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,849
    I haven't gone through them with a fine toothed comb, but, on the surface, they appear syntactically correct, they appear to represent something similar to the equations posted. If there's an error, it's not immediately apparent to me.

  12. #12
    Registered User
    Join Date
    03-15-2007
    Posts
    14
    Thank you

    I appreciate your help

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1