+ Reply to Thread
Results 1 to 7 of 7

If function giving wrong answer

  1. #1
    Registered User
    Join Date
    05-09-2022
    Location
    England
    MS-Off Ver
    2019
    Posts
    3

    If function giving wrong answer

    =IF(AW5>T5,"B",IF(AW5=T5,"G",IF(T5-AW5=1,"A",IF(T5-AW5>=2,"R"))))

    Using the formula above I'm getting B show up in places it shouldn't. I'm quite new to this so could be missing something very obvious!

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel (Windows 11 64-bit)
    Posts
    61,986

    Re: If function giving wrong answer

    Welcome to the forum.

    Sorry - can't tell from the formula what might be wrong. Do you have text values that are being treated as numbers? If so, try this:

    =IF(AND(ISNUMBER(AW5),AW5>T5),"B",IF(AW5=T5,"G",IF(T5-AW5=1,"A",IF(T5-AW5>=2,"R"))))

    There are instructions at the top of the page explaining how to attach your sample workbook.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. It also has expected results mocked up, relevant cells highlighted and a few explanatory notes.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" to anyone who has offered you help in your thread. You can reward them by clicking on * Add Reputation below theur user name on the left, if you wish.


    Forum Rules (updated September 2018): please read them here.
    How to use the Power Query code you've been given: help here. More about the Power suite here.

  3. #3
    Registered User
    Join Date
    05-09-2022
    Location
    England
    MS-Off Ver
    2019
    Posts
    3

    Re: If function giving wrong answer

    Hi - thanks for the quick response.

    It's part of a huge spreadsheet where AW depends on the outcome of 5 other cells so I'm struggling to attach. I've attached a picture for now while I figure it out

    The formula you gave me above returns the correct result in some cells, but others change to FALSE

    Capture.PNG

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel (Windows 11 64-bit)
    Posts
    61,986

    Re: If function giving wrong answer

    Read what I said again:

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. It also has expected results mocked up, relevant cells highlighted and a few explanatory notes.
    I can't work with a picture, but if that first criterion is returning "B", then either the value in T or the one in AW is text (or both are).

  5. #5
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,436

    Re: If function giving wrong answer

    Try this:

    =IF(AW5-T5>0,"B",IF(AW5-T5=0,"G",IF(T5-AW5=1,"A","R")))

  6. #6
    Registered User
    Join Date
    05-09-2022
    Location
    England
    MS-Off Ver
    2019
    Posts
    3

    Re: If function giving wrong answer

    Thank you - this worked!

    The values in T are mostly imported from elsewhere. Those that were typed in manually were the ones giving incorrect results.

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel (Windows 11 64-bit)
    Posts
    61,986

    Re: If function giving wrong answer

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, if you have not already done so, you may not be aware that you can thank those who have helped you by clicking the small star icon (* Add Reputation) 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 all those who offered 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. Date Calculation is giving wrong answer!
    By simplyoooo in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-20-2019, 06:35 PM
  2. [SOLVED] splitting formula giving wrong answer in a particular for specific pack size description
    By JEAN1972 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-28-2018, 01:40 PM
  3. [SOLVED] If function giving me the wrong answer
    By lmcc007 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-25-2018, 08:08 AM
  4. [SOLVED] Dividing cell is giving wrong answer
    By jwlamb in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-30-2014, 08:15 PM
  5. [SOLVED] Using Offset function as the array in the PercentRank function is giving wrong result
    By Bobneil in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 08-06-2013, 09:29 PM
  6. Vlookup giving wrong answer
    By toclare84 in forum Excel General
    Replies: 5
    Last Post: 08-26-2010, 08:53 AM
  7. IF function giving wrong result
    By dzorug in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-23-2005, 11:41 AM

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