Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: vlookup

  1. #1
    Board Regular
    Join Date
    Mar 2002
    Posts
    83
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    i have the following example

    Column A Column B

    a1: Yankees b1: 10
    a2: Mets b2: 20
    a3: Dodgers b3: 30

    vlookup on the dodgers - 2nd column will return 30 - but what if want the cell directly above (20). is there a formula?

    thanks

  2. #2
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Denver, CO
    Posts
    1,743
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    You could try
    =OFFSET($A$1,MATCH("dodgers",$A$1:$A$3,0)-2,1)

    What results would you expect if Yankees were entered? this will give you a #ref! error.

  3. #3
    MrExcel MVP Aladin Akyurek's Avatar
    Join Date
    Feb 2002
    Location
    The Hague, NL
    Posts
    83,637
    Post Thanks / Like
    Mentioned
    33 Post(s)
    Tagged
    6 Thread(s)

    Default

    On 2002-04-22 13:42, mcarter973 wrote:
    i have the following example

    Column A Column B

    a1: Yankees b1: 10
    a2: Mets b2: 20
    a3: Dodgers b3: 30

    vlookup on the dodgers - 2nd column will return 30 - but what if want the cell directly above (20). is there a formula?

    thanks
    =INDEX(B1:B100,MATCH(E1,A1:A100,0)-2)

    where A1 houses a lookup value like "dodgers".

    You'll get an error though when the lookup value matches a value in A1 or A2.

    Just curious: Is there a particular reason for why you want it this way?

    Aladin

  4. #4
    Board Regular
    Join Date
    Mar 2002
    Posts
    83
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    i am using the calendar month end date as opposed to the last working date. for example, march 28 is the last business day but march 31 is the last business day. currently, vlookup will look up the the last workday (including holidays)and subtract 1. this works for all days except when the calendar month end falls on a weekend or holiday.

    with the dates in column A, i would like to lookup the dates in column A and grab the date in the cell directly above. for example, if B1 houses the lookup value March 31, i want to find March 31 in column A and grab the cell above which is March 27.



  5. #5
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Denver, CO
    Posts
    1,743
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    You may want to try manipulate your date with something like
    =WORKDAY(B1,(MAX(WEEKDAY(B1,2)>5,COUNTIF(holiday,B1)))*-1,holiday)-1

    where "holiday" is a named list of your holidays. this could be used as the lookup term in vlookup.

    workdays requires the analyst tool pak to be installed.

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •