+ Reply to Thread
Results 1 to 18 of 18

IF function for OK and NC status based on numeric cell values

  1. #1
    Registered User
    Join Date
    03-23-2013
    Location
    pakistan
    MS-Off Ver
    Excel 2013
    Posts
    12

    Question IF function for OK and NC status based on numeric cell values

    i'm trying to get result in form of "OK" or "NC"for reporting purpose.
    i.e.

    IF(C3>=A3,"OK",(C3<=B3,"OK","NC"))

    but formula doesn't work reading the numerical values from the cells(even not read as formula)
    moreover, it should give the proper result whether both A3,B3 are filled or only one of them(i.e. B3 or C3)
    All values in A3,B3,C3 are numeric.

    regards,

    Fahad
    Attached Files Attached Files

  2. #2
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: IF function for OK and NC status based on numeric cell values

    Correct your formula as below
    =IF(C3>=A3,"OK",IF(C3<=B3,"OK","NC"))
    or try the below one
    =IF(OR(C3>=A3,C3<=B3),"OK","NC")
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,939

    Re: IF function for OK and NC status based on numeric cell values

    I'm not exactly sure what you are trying to calculate.

    Tell us in simple language the criteria for OK. I cannot tell if you want C3>A3 and C3<B3 to be OK or if only one of the critieria is there then it is OK. Spell out the criteria for us.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Registered User
    Join Date
    03-23-2013
    Location
    pakistan
    MS-Off Ver
    Excel 2013
    Posts
    12

    Re: IF function for OK and NC status based on numeric cell values

    i want the outcome "OK" whenever (a)C3 is either equal to A3 or greater then A3 (b) is either less than B3 or equal to it.
    it should also give OK when only one of the criteria is specified and the other one is missing.

    And Siva, the suggested formulae are not working. I think it could work with a combination of ÏF & AND formulas.

    Regards,
    Last edited by fhadzafar; 11-26-2014 at 10:25 AM. Reason: reply to Siva as well

  5. #5
    Registered User
    Join Date
    03-23-2013
    Location
    pakistan
    MS-Off Ver
    Excel 2013
    Posts
    12

    Re: IF function for OK and NC status based on numeric cell values

    Criteria are the values written in cells A3 and B3. I've also attached the file modified after adding OR function into the formula. but it doesn't work one value is not mentioned in cell B3.
    Attached Files Attached Files
    Last edited by fhadzafar; 12-19-2014 at 12:42 PM. Reason: added file

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,939

    Re: IF function for OK and NC status based on numeric cell values

    Based upon your explanation, Siva's formula

    =IF(OR(C3>=A3,C3<=B3),"OK","NC") should be the correct answer. If this is not what you are looking for, then please provide examples of what you are attempting, with both OK examples and NC examples manually expressed.

  7. #7
    Registered User
    Join Date
    03-23-2013
    Location
    pakistan
    MS-Off Ver
    Excel 2013
    Posts
    12

    Re: IF function for OK and NC status based on numeric cell values

    screen.PNG

    Example provided in this screen shot please.

  8. #8
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,939

    Re: IF function for OK and NC status based on numeric cell values

    I don't understand. In the second example, 31 is greater than 28. You indicated that your criteria is C3 is greater than A3 or C3 is less than B3. So this is true. Is your criteria now different?

  9. #9
    Registered User
    Join Date
    03-23-2013
    Location
    pakistan
    MS-Off Ver
    Excel 2013
    Posts
    12

    Re: IF function for OK and NC status based on numeric cell values

    Yes you are right that it is true for Sr. # 2 where 31 is greater than 28. But, problem is that it is not the output of formula.
    I've written it for demonstration purpose on screen only, as been asked.
    Using the suggested formula the result is "NC" (which is wrong).

  10. #10
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: IF function for OK and NC status based on numeric cell values

    show us in another workbook
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  11. #11
    Registered User
    Join Date
    03-23-2013
    Location
    pakistan
    MS-Off Ver
    Excel 2013
    Posts
    12

    Re: IF function for OK and NC status based on numeric cell values

    needful done. hope it clarifies.
    Attached Files Attached Files

  12. #12
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: IF function for OK and NC status based on numeric cell values

    =IF(OR(C3>=A3,C3<=B3),"OK","NC")
    why have you used * ?
    =IF(OR(D3>=B3)*(D3<=C3),"OK","NC") also
    since b3 is blank in scen.3 d3 is larger than b3 so you will get ok

  13. #13
    Registered User
    Join Date
    03-23-2013
    Location
    pakistan
    MS-Off Ver
    Excel 2013
    Posts
    12

    Re: IF function for OK and NC status based on numeric cell values

    But what about the 2nd condition in the formula i.e. D3<=C3 which is not fulfilled but result is still ÖK" ? how can i cater this ?
    using the formula =IF(OR(C3>=A3,C3<=B3),"OK","NC")
    Last edited by fhadzafar; 12-21-2014 at 11:39 AM.

  14. #14
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: IF function for OK and NC status based on numeric cell values

    it says OR so either can be true try AND so both must be true to work
    =IF(AND(D3>=B3,D3<=C3),"OK","NC")

  15. #15
    Registered User
    Join Date
    03-23-2013
    Location
    pakistan
    MS-Off Ver
    Excel 2013
    Posts
    12

    Re: IF function for OK and NC status based on numeric cell values

    I've already tried AND. It doesn't give the required output. It gives NC for the case at Sr. #2
    screen 2.PNG

  16. #16
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: IF function for OK and NC status based on numeric cell values

    try
    =IF(D3="","",IF(OR(AND(B3="",D3<=C3),AND(C3="",D3>=B3)),"y",IF(AND(D3>=B3,D3<=C3),"y","n")))

  17. #17
    Registered User
    Join Date
    03-23-2013
    Location
    pakistan
    MS-Off Ver
    Excel 2013
    Posts
    12

    Re: IF function for OK and NC status based on numeric cell values

    Great! Its working fine.
    Thanks Martindwilson

  18. #18
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: IF function for OK and NC status based on numeric cell values

    thanks for the feedback,glad we could help

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Add up values of a specific month based on status
    By BartDeHertogh in forum Excel General
    Replies: 4
    Last Post: 09-30-2010, 07:22 AM
  2. Count unique values of Test ID's based on Status
    By mehulpatel in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-04-2010, 03:04 AM
  3. Listing values into one cell based on a status...
    By wanton007 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-25-2009, 02:52 AM
  4. Applying numeric values in one cell based on text in another
    By Chi_TechWriter in forum Excel General
    Replies: 3
    Last Post: 02-03-2006, 04:15 PM
  5. [SOLVED] Adding a new function to values in the status bar
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-11-2005, 07:05 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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1