New call-to-action
Results 1 to 4 of 4

Thread: Expression problem

  1. #1
    Member
    Real Name
    David L. Aery
    Join Date
    Dec 2004
    Location
    Missouri
    Posts
    336

    Default Expression problem

    I have an expression defined in field rules under the field called cost;

    ((VENDORPRICE-(VENDORPRICE*DISCOUNT))/UNIT)

    My result for example is .01811

    When I add this to the end of the above expression;
    +(FREIGHT/FREIGHTUNIT)
    if the freightunit is blank, my value is 0. If I put a 1 in the freightunit then my value is .01811
    Sometimes there is no freight so nothing is entered in the freight and freighunit, so then my cost becomes 0. What can I do to the expression so I don't have to enter 1 in the freightunit when there is no freight? When I add freight and freightunit it works correctly.
    What am I doing wrong?

    Thanks,
    DAvid

  2. #2
    Member
    Real Name
    David L. Aery
    Join Date
    Dec 2004
    Location
    Missouri
    Posts
    336

    Default RE: Expression problem

    I fixed my problem, I'm not sure why, but I was dividing 0 by 0 and when you do that on a calculator you get an error. Anything divided by itself is 1 and 0 divided by 0 is not 1.
    Here is my formula;

    (VENDORPRICE-(VENDORPRICE*DISCOUNT))/UNIT+IF(FREIGHTUNIT=0,0,FREIGHT/FREIGHTUNIT)

    David

  3. #3
    Volunteer Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,666

    Default RE: Expression problem

    David

    Division by zero (mathematically) is undefined.

    Your solution is the correct one to use.

  4. #4
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default RE: Expression problem

    Not particularly important but since it appears that discount is a decimal (like .10)

    (VENDORPRICE-(VENDORPRICE*DISCOUNT))

    could be

    (VENDORPRICE*(1-DISCOUNT))

Similar Threads

  1. Expression problem
    By Steve Bovino in forum Alpha Five Version 6
    Replies: 2
    Last Post: 10-08-2005, 01:15 PM
  2. Expression Problem
    By bporter101 in forum Alpha Five Version 6
    Replies: 2
    Last Post: 06-30-2005, 05:01 PM
  3. Problem with expression...
    By Robin Smith in forum Alpha Five Version 5
    Replies: 9
    Last Post: 05-09-2004, 01:59 PM
  4. expression problem
    By Jeff Pearson in forum Alpha Five Version 5
    Replies: 8
    Last Post: 09-18-2003, 11:31 AM
  5. Expression Problem
    By BRIAN GRAY in forum Alpha Five Version 5
    Replies: 4
    Last Post: 04-17-2003, 01:59 PM

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
  •