vlookup

mcarter973

Board Regular
Joined
Mar 24, 2002
Messages
83
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
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
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.
 
Upvote 0
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
 
Upvote 0
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.
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,214,388
Messages
6,119,229
Members
448,879
Latest member
VanGirl

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top