+ Reply to Thread
Results 1 to 11 of 11

Help with a forumla, IF or DIFF???

  1. #1
    Registered User
    Join Date
    12-31-2012
    Location
    Switzerland - from UK
    MS-Off Ver
    Excel 2013 (office 365), Win 7 Enterprise (work9
    Posts
    13

    Help with a forumla, IF or DIFF???

    I'm not great with Excel 2010 but I get by.

    I need to write a forumula which compares the difference between two numbers in two cells and writes a word in the third cell. The rule is B1 - A1. If that resulting number is less than -0.25 then it's "good" if it's more than -0.25 but less than 0.25 then it's "ok" and if it's more than 0.25 then it's "bad". The other problem I have is A1 is on a page called "clock" and B1 is on another page called "times" so it makes it more complicated. So far I have this forumla

    =IF(('times'!B1-clock!AL36)<0.25,"good") So this works for less than 0.25 but how do I add to the forumla for between -025 to +0.25 and more than 0.25


    A B C
    4 3 good


    A B C
    4 4.1 ok (C is OK as A and B are within the limit -0.25 and +0.25)


    A B C
    4 4.3 bad (B1is more than 0.25 greater than A1)



    My brain is wrecked. Happy new year too.

    Iain
    Last edited by Dr_Watson; 01-02-2013 at 04:02 AM.

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Help with a forumla, IF or DIFF???

    Hello Iain, try this version

    =IF('times'!B1-clock!AL36<-0.25,"good",IF('times'!B1-clock!AL36<0.25,"ok","bad"))
    Audere est facere

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,629

    Re: Help with a forumla, IF or DIFF???

    never mind.
    Ben Van Johnson

  4. #4
    Valued Forum Contributor
    Join Date
    09-10-2012
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2010
    Posts
    929

    Re: Help with a forumla, IF or DIFF???

    Hi Iain,

    You need Nested IF statements...

    The IF formula actually should be 3 items... IF(condition, true, false)

    The condition in your formuls is good... ('times'!B1-clock!AL36)<0.25 this will result in TRUE or FALSE...

    Your true statement is right too, "good"

    Now your false statement is missing, which if you only had 2 "results" then this is where the other "word" will be put (ie not meeting your condition)

    But since you have 3 conditions, then a nested if is needed...

    Try this...
    =IF(('times'!B1-clock!AL36)<0.25,"good",IF(('times'!B1-clock!AL36)>0.25,"bad","ok"))

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Help with a forumla, IF or DIFF???

    Hi Dr Watson, welcome to the forum (Moriarty went that-a-way by the way <--->)

    you just need to nest more if() statements...
    =IF('times'!B1-clock!AL36<-0.25,"good",IF(and('times'!B1-clock!AL36>=-0.25,'times'!B1-clock!AL36<0.25),"ok","bad"))
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  6. #6
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: Help with a forumla, IF or DIFF???

    Quote Originally Posted by FDibbins View Post
    Hi Dr Watson, welcome to the forum (Moriarty went that-a-way by the way <--->)

    you just need to nest more if() statements...
    =IF('times'!B1-clock!AL36<-0.25,"good",IF(and('times'!B1-clock!AL36>=-0.25,'times'!B1-clock!AL36<0.25),"ok","bad"))
    It's not necessary to use AND function for this. See post #2

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Help with a forumla, IF or DIFF???

    yes I saw that, Teethless, thanks and that is indeed a better way to go. However, I thought I would include the and(), so the OP can see how that works too

  8. #8
    Registered User
    Join Date
    12-31-2012
    Location
    Switzerland - from UK
    MS-Off Ver
    Excel 2013 (office 365), Win 7 Enterprise (work9
    Posts
    13

    Re: Help with a forumla, IF or DIFF???

    Thanks for the really fast replies.

    reply 1

    =IF('times'!B1-clock!AL36<-0.25,"good",IF('times'!B1-clock!AL36<0.25,"ok","bad"))

    Rules doesn't quite work correctly. Giving me the wrong result

    All other suggestions give an error, incorrect furmula or missing argument, I am double checking and can't find any mistakes.

    I'm still working it, maybe I get it working shortly..it could be, the result is correct, by my calculations are wrong, let me check.
    Last edited by Dr_Watson; 12-31-2012 at 05:48 PM.

  9. #9
    Registered User
    Join Date
    12-31-2012
    Location
    Switzerland - from UK
    MS-Off Ver
    Excel 2013 (office 365), Win 7 Enterprise (work9
    Posts
    13

    Re: Help with a forumla, IF or DIFF???

    Working now.

    Thanks for all the help, I made a small mistake in what I was calculating, should be clock-times, not times-clock.

    So with that correction, I think everybody gave me a correct answer. I can now relax!

    Happy New Year all.

    Iain

  10. #10
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Help with a forumla, IF or DIFF???

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a relatively new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  11. #11
    Registered User
    Join Date
    12-31-2012
    Location
    Switzerland - from UK
    MS-Off Ver
    Excel 2013 (office 365), Win 7 Enterprise (work9
    Posts
    13

    Re: Help with a forumla, IF or DIFF???

    Thanks FDibbins. Itīs solved and reputation is marked. I have the site saved, the replies were good and super fast so I will be back at somepoint.

    Cheers

    Iain

+ 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