+ Reply to Thread
Results 1 to 6 of 6

Formula that returns values based on criteria

  1. #1
    Registered User
    Join Date
    09-17-2012
    Location
    Denver, CO
    MS-Off Ver
    Excel 2010
    Posts
    13

    Formula that returns values based on criteria

    I am trying to create a table that returns values based on a set of criteria. A is a formula that generates a numeric value. The criteria are as follows:
    If A<1, return -4
    If 1<A<2, return -3
    If 2<A<3, return 1
    If 3<A, return 4

    I then want to use this table and, based on the value of A, return the correct value. I am having difficulty for the values that are less than 1 and greater than 3. Any ideas on how to setup a table or generate the values that I would like without doing a long nested if?

    Thank you!

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Formula that returns values based on criteria

    How about...

    =LOOKUP(A1,{0,1,2,3},{-4,-3,1,4})
    HTH
    Regards, Jeff

  3. #3
    Registered User
    Join Date
    09-17-2012
    Location
    Denver, CO
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Formula that returns values based on criteria

    Quote Originally Posted by jeffreybrown View Post
    How about...

    =LOOKUP(A1,{0,1,2,3},{-4,-3,1,4})
    Jeff - this works perfectly except for values below 0. What do you recommend for negative values?

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Formula that returns values based on criteria

    What do you want for a value below 0?

    If you don't want anything for a negative number...

    =IF(A1<0,"",LOOKUP(A1,{0,1,2,3},{-4,-3,1,4}))

  5. #5
    Registered User
    Join Date
    09-17-2012
    Location
    Denver, CO
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Formula that returns values based on criteria

    Quote Originally Posted by jeffreybrown View Post
    What do you want for a value below 0?

    If you don't want anything for a negative number...

    =IF(A1<0,"",LOOKUP(A1,{0,1,2,3},{-4,-3,1,4}))
    Thanks, Jeff. Got it!

  6. #6
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Formula that returns values based on criteria

    You are very welcome. Glad to have helped and thanks for the feedback.

+ 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