+ Reply to Thread
Results 1 to 6 of 6

Simple (and stupid) IF question -get value if number is between 1-4,4-8 etc..

  1. #1
    Registered User
    Join Date
    01-04-2015
    Location
    dk
    MS-Off Ver
    2010
    Posts
    8

    Simple (and stupid) IF question -get value if number is between 1-4,4-8 etc..

    Iīm trying to get excel to insert a given value based on some criterias..should be simple, but i canīt get it working
    If R2 is <4 it should get the value W2,4-7 should get X2, 8-11 should get Y2 and so on.
    I have it working up till 7, but when i get 8, it doesnīt change value?
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    As i said, should be simple, but itīs driving me mad

  2. #2
    Forum Contributor
    Join Date
    07-13-2015
    Location
    Quebec, Canada
    MS-Off Ver
    2013
    Posts
    232

    Re: Simple (and stupid) IF question -get value if number is between 1-4,4-8 etc..

    You're doing it in the wrong order. As you typed it, as long as R2 >= 4, it will stop there since it meets the conditions.

    Do it backwards.

    =IF(R2>=4;(X2);IF(R2>=8;(Y2);IF(R2>=12;(Z2);IF(R2>=16;(AA2);W2))))
    =IF(R2>=16;AA2;IF(R2>=12;Z2;IF(R2>=8;Y2;IF(R2>=4;X2;W2))))

  3. #3
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Simple (and stupid) IF question -get value if number is between 1-4,4-8 etc..

    Or don't even use IF to begin with.
    Use LOOKUP instead..

    =LOOKUP(R2,{0,4,8,12,16},W2:AA2)

    Or since you have such a nice even pattern of 4's, try

    =INDEX(W2:AA2,INT(R2/4)+1)

  4. #4
    Registered User
    Join Date
    09-05-2014
    Location
    Montreal
    MS-Off Ver
    2007
    Posts
    22

    Re: Simple (and stupid) IF question -get value if number is between 1-4,4-8 etc..

    I think its because for a given value, multiple conditions are met at the same time and Excel returns the value associated to the first condition. e.g. if R2=13 then R2>=8 = true AND R2>=12= true thus the return value is 8. Try:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-04-2015
    Location
    dk
    MS-Off Ver
    2010
    Posts
    8

    Re: Simple (and stupid) IF question -get value if number is between 1-4,4-8 etc..

    Thanks both of you! As I said simple, but I had been staring me blind on it.
    The Index function is neat..hadnīt thought of that

  6. #6
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Simple (and stupid) IF question -get value if number is between 1-4,4-8 etc..

    You're welcome.

+ 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. stupid simple question probably!
    By honoluuluu in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-05-2015, 07:22 PM
  2. Stupid, stupid question....
    By DS in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-25-2005, 11:05 AM
  3. 3 stupid, simple IFs
    By JMB in forum Excel Formulas & Functions
    Replies: 24
    Last Post: 09-06-2005, 12:05 PM
  4. [SOLVED] 3 stupid, simple IFs
    By JMB in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 09-06-2005, 06:05 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