+ Reply to Thread
Results 1 to 9 of 9

get value from column

  1. #1
    Registered User
    Join Date
    01-20-2010
    Location
    bangladesh
    MS-Off Ver
    Excel 2007
    Posts
    49

    get value from column

    Hi
    I have a column and values in the column (A) 1,2,3,4,6,8,12,16,18,25,39,87 in rows.
    Now I need that
    in Cell B1 value will be input cell and Cell B2 will be output cell
    I required this
    if B1 is 1 then B2 is 1
    if B1 is 3 then B2 is 3
    if B1 is 13 then B2 is 16
    NB: in Column A values are in lowest to highest order.
    So please help me what will be the formula of B2.
    I dont want to use VB

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: get value from column

    hi arctushar. if i understood correctly, it should return the same value if it finds an exact match? otherwise, return the next highest value? no match for 13, so it's between 12 & 16. pick 16 because it's higher? if so, try:
    =INDEX(A1:A12,MATCH(TRUE,INDEX((A1:A12>=B1),),0))

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: get value from column

    So, if there is not an exact match then you want the next higher value?

    Try this array formula**:

    =IF(B1>A12,"N/A",MIN(IF(A1:A12>=B1,A1:A12)))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Registered User
    Join Date
    01-20-2010
    Location
    bangladesh
    MS-Off Ver
    Excel 2007
    Posts
    49

    Re: get value from column

    Thnaks benishiryo very much
    Would u plz explain how its working ?
    specially what is ),),0)) at last

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: get value from column

    Try this in B2...
    =INDEX($A$1:$A$12,IFERROR(MATCH(B1,A1:A12,0),MATCH(B1,A1:A12,1)+1),1)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  6. #6
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: get value from column

    you're very welcome.

    A1:A12>=B1
    this is a logical test to find out if A1:A12 is greater or equals to B1. if B1 is 13, it will return:
    {FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;TRUE;TRUE;TRUE;TRUE;TRUE}
    the 1st TRUE is the answer we need

    MATCH(TRUE,A1:A12>=B1,0)
    you can then use a MATCH formula to return the position the 1st TRUE is in. however, this will become an array formula, where you have to press CTRL + SHIFT + ENTER to confirm.

    MATCH(TRUE,INDEX((A1:A12>=B1),),0)
    by storing it inside the INDEX formula, i can make it not become an array formula. you can do this by putting in the logical test inside the array portion of the INDEX formula, and put in nothing (like what i did) or 0 in the row_num portion of the INDEX formula. it is equivalent to putting
    MATCH(TRUE,INDEX((A1:A12>=B1),0),0)

    hope that helps

  7. #7
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: get value from column

    Quote Originally Posted by arctushar View Post
    Thnaks benishiryo very much
    Would u plz explain how its working ?
    specially what is ),),0)) at last
    another one for you to know

    ),),))

  8. #8
    Registered User
    Join Date
    01-20-2010
    Location
    bangladesh
    MS-Off Ver
    Excel 2007
    Posts
    49

    Re: get value from column

    Thanks FDibbins
    yours one is more simple
    I like it

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: get value from column

    Happy to help. If this answered your question, please take a moment to mark the thread as "solved" - it helps keep things neet and tidy lol, and consider adding the reputation to those that helped (see points 2 & 3 below)

+ 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