Consulting

Results 1 to 5 of 5

Thread: Need help with a Formula

  1. #1
    VBAX Regular
    Joined
    Mar 2005
    Posts
    33
    Location

    Need help with a Formula

    Hi I am having probs with a formula..

    =IF(D12=0,0,ROUNDDOWN(+E12/E7,2))
    works fine

    I want to add one more condition

    =IF(D12=0 OR D7=0,0,ROUNDDOWN(+E12/E7,2))
    doesnt work

    it throws up an error when I add OR D7=0...

    Any idea on how i can incorporate both conditions.

    Regards
    Tinku

  2. #2
    Knowledge Base Approver
    Space Cadet
    VBAX Tutor sandam's Avatar
    Joined
    Jan 2005
    Location
    London
    Posts
    292
    Location
    Maybe try this??

    IF(Or(D12=0,D7=0),0,ROUNDDOWN(+E12/E7,2))
    Nothing annoys a non-conformist more than other non-conformists who refuse to conform to the rules of non-conformity.


    Confused is my normal state of mind


  3. #3
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    Alternately you can multiply the cells to see if they are zero (which would indicate at least one of them is zero).

    If(D12*D7=0,0,ROUNDDOWN(E12/E7,2))
    And we can eliminate the =0 part.

    If(D12*D7,ROUNDDOWN(E12/E7,2),0)

  4. #4
    VBAX Regular
    Joined
    Mar 2005
    Posts
    33
    Location
    Sweeeeeeeet... Thanks Sandam and DRJ..
    I am using Sandam's formula and it works like a charm..

    DRJ I will give ur formula a shot..but having a hard time figuring out how
    the 2nd one works..
    If(D12*D7,ROUNDDOWN(E12/E7,2),0)

    Regards
    Tinku

  5. #5
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    0 = False

    So if D12*D7 is equal to 0 the If formula will evaluate the False portion otherwise it will evaluate the True portion.

    When you use D12*D7=0 that will be evaluated to True or False. But in this case if D12*D7 is equal to 0 it will be evaluated to True.

    Hopefully that makes sense.

    Also, any of these formulas will work just fine, so use the one that you understand the best. I just wanted to point out some variations.

Posting Permissions

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