+ Reply to Thread
Results 1 to 7 of 7

IF Function postive and 0 problem

  1. #1
    Forum Contributor
    Join Date
    05-16-2011
    Location
    Philippines
    MS-Off Ver
    Excel 365/Excel 2016
    Posts
    315

    IF Function postive and 0 problem

    Hi to all,

    I got a problem in coding IF Function, here is the condition

    Condition:
    AP is Negative and AR is Zero-OK
    AP is 0 and AR is Positive-OK
    AP is Positive and AR is Postive- OK

    AP is 0 and AR is Negative-NOT OK
    AP is postive and AR is Negative-NOT OK
    AP is 0 and AR is 0-NOT OK

    Now the problem is, 0 is considered as "Positive" and it just resulted as "OK" if both AP and AR have 0 value. Kindly help!. Thanks


    here is my 2 function code, but still resulted to "OK".

    1. =IF(OR(AND(LEFT(F4,1)="-",G4=0),AND(F4=0,LEFT(G4,1)<>"-"),AND(LEFT(F4,1)<>"-",LEFT(G4,1)<>"-")),"OK","NOT OK")

    2. =IF(AND(LEFT(F4,1)="-",G4=0),"OK",IF(AND(F4=0,LEFT(G4,1)<>"-"),"OK",IF(AND(F4=0,G4=0),"NOT OK",)))
    Last edited by emina002; 02-12-2013 at 01:03 AM.

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: IF Function postive and 0 problem

    hi emina002, it's a little confusing when you talk about AP & AR but used formulas that show F4 & G4. i'm assuming AP is F4 & AR is G4? please upload a sample Excel file if i'm wrong:
    =IF(OR(G4<0,COUNTIF(F4:G4,0)=2),"NOT OK","OK")

    seems like if AR is negative or both AP & AR is 0, it is NOT OK.

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,695

    Re: IF Function postive and 0 problem

    Don't try to isolate the minus sign, use less than zero: <0

    For example: ...AND(F4<0, G4=0)...

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Forum Contributor
    Join Date
    05-16-2011
    Location
    Philippines
    MS-Off Ver
    Excel 365/Excel 2016
    Posts
    315

    Re: IF Function postive and 0 problem

    Hi there I am referring for the cells(F4 and G4), see attach workbook for sample, AP and AR amount are just column with amount.
    Attached Files Attached Files

  5. #5
    Valued Forum Contributor
    Join Date
    02-05-2013
    Location
    Jakarta, Indonesia
    MS-Off Ver
    Excel 2013
    Posts
    571

    Re: IF Function postive and 0 problem

    Try this:

    Formula 1
    Please Login or Register  to view this content.
    Formula 2
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    05-16-2011
    Location
    Philippines
    MS-Off Ver
    Excel 365/Excel 2016
    Posts
    315

    Re: IF Function postive and 0 problem

    Hi to all,this problem has been solve.With the formula you given, I just used this

    =IF(AND(A2<0,B2=0),"OK",IF(AND(A2=0,B2>0),"OK",IF(AND(A2>0,B2>0),"OK",IF(AND(A2=0,B2=0),"NOT OK",IF(AND(A2>0,B2<0),"NOT OK",IF(AND(A2=0,B2<0),"NOT OK"))))))

  7. #7
    Valued Forum Contributor
    Join Date
    02-05-2013
    Location
    Jakarta, Indonesia
    MS-Off Ver
    Excel 2013
    Posts
    571

    Re: IF Function postive and 0 problem

    Better you make it simple

    Look carefully on your condition: if (AP is positive or zero) and (AR is zero or positive) is "OK", you can write like this " IF(AND(AP>=0,AR>=0),"OK","NOT OK")
    Last edited by SDCh; 02-12-2013 at 02:17 AM.

+ 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