+ Reply to Thread
Results 1 to 9 of 9

IF match number THEN return other number

  1. #1
    Registered User
    Join Date
    09-02-2011
    Location
    Bulgaria
    MS-Off Ver
    2013
    Posts
    91

    Lightbulb IF match number THEN return other number

    Hi all,

    can someone please help me with this:

    IF cell A1 = from 0 to 2 then cell B1 = 0
    IF cell A1 = from 3 to 4 then cell B1 = 2
    IF cell A1 = from 5 to 6 then cell B1 = 4
    IF cell A1 = 7 or higher then cell B1 = 6


    i guess its easy formula but im newbie in excel and my formula syntax sucks.

    Thank you in advance!
    Last edited by godlev; 10-12-2011 at 04:13 AM. Reason: Solved

  2. #2
    Forum Contributor
    Join Date
    08-01-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2007
    Posts
    182

    Re: IF match number THEN return other number

    Try this:

    =IF(A1<2.01,0,IF(A1<4.01,2,IF(A1<6.01,4,6)))

  3. #3
    Registered User
    Join Date
    12-24-2009
    Location
    Istanbul
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: IF match number THEN return other number

    to Worksheet_SelectionChange :

    Select Case [A1].Value
    Case Is > 0
    [b1] = 0
    Case Is > 2
    [b1] = 2
    Case Is > 4
    [b1] = 4
    Case Is > 6
    [b1] = 6
    End Select

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: IF match number THEN return other number

    Try this in B1:

    =LOOKUP(A1, {0,3,5,7}, {0,2,4,6})
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  5. #5
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: IF match number THEN return other number

    Try

    =INDEX({0,2,4,6},MATCH(A1,{0,3,5,7}))

  6. #6
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,866

    Re: IF match number THEN return other number

    maybe this:

    =MIN(6, 2*INT(A1/2))
    Never use Merged Cells in Excel

  7. #7
    Registered User
    Join Date
    09-02-2011
    Location
    Bulgaria
    MS-Off Ver
    2013
    Posts
    91

    Re: IF match number THEN return other number

    Thank you Inayat your example matches my requirements perfectly - Thanks!
    This thread is solved!

  8. #8
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: IF match number THEN return other number

    Quote Originally Posted by godlev View Post
    Thank you Inayat your example matches my requirements perfectly - Thanks!
    This thread is solved!
    Wrong choice!

  9. #9
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,866

    Re: IF match number THEN return other number

    I agree with Bob Phillips,
    but even if you using this solution you should notice that it will return wrong result for 2,005

    so, NEVER use this sintax (for example for less or equal 12 DON'T use <12,0001)

    You have <= sign, so your formula became:

    =IF(A1<=2,0,IF(A1<=4,2,IF(A1<=6,4,6)))
    Last edited by zbor; 10-12-2011 at 04:27 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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