+ Reply to Thread
Results 1 to 11 of 11

IF function - comparing data in range

Hybrid View

  1. #1
    Registered User
    Join Date
    06-14-2012
    Location
    Riga, Latvia
    MS-Off Ver
    Excel 2007
    Posts
    17

    IF function - comparing data in range

    Hi,

    Is there any way how I can get with function IF a result in some range of data?

    For example:

    I have two columns with data
    A1 - 100 B1 - 104
    A2 - 12 B2 - 13

    What I want is IF B1 is +/-3 than it returns "Same", IF smaller than +/-3 "Down", else "Up".
    Last edited by Yahoho; 06-15-2012 at 08:11 AM.

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: IF function - comparing data in range

    Hi Yahoho, welcome to the forum.

    You could try either:

    =IF(ABS(A1-B1)=3,"Same",IF(ABS(A1-B1)<3,"Down","Up"))

    or

    =LOOKUP(ABS(A1-B1),{0,3,4},{"Down","Same","Up"})

    Hope that helps!

  3. #3
    Registered User
    Join Date
    06-14-2012
    Location
    Riga, Latvia
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: IF function - comparing data in range

    Hi,

    It looks like it isin't what I need.
    I added an example with data and my variation, that returns result if it perfectly match. But with posted options I don't get right result.
    Attached Files Attached Files

  4. #4
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: IF function - comparing data in range

    Show us what *SHOULD* be the result for all of those examples, and explain why for the first several rows.

  5. #5
    Registered User
    Join Date
    06-14-2012
    Location
    Riga, Latvia
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: IF function - comparing data in range

    Hope this time I will make my self clear.

    See attached example and explanation.
    Attached Files Attached Files

  6. #6
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,366

    Re: IF function - comparing data in range

    Hello
    can you try again the above explanation...

    What I want is IF B1 is +/-3 than it returns "Same", IF smaller than +/-3 "Down", else "Up".
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  7. #7
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: IF function - comparing data in range

    Try

    =IF(ABS(A2-B2)<=3,"Same",IF(A2-B2>3,"Up","Down"))

  8. #8
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,366

    Re: IF function - comparing data in range

    maybe like this..

    =IF(AND(A2<B2,ABS(A2-B2)>3),"Down",IF(AND(A2>B2,ABS(A2-B2)>3),"up","Same"))

  9. #9
    Registered User
    Join Date
    06-14-2012
    Location
    Riga, Latvia
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: IF function - comparing data in range

    Both solutions works perfectly. Thank you very much.

  10. #10
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,366

    Re: IF function - comparing data in range

    use the shorter one...

  11. #11
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: IF function - comparing data in range

    You're welcome. Thanks for the 'star tap'.

+ 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