MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Apr 29th, 2002, 04:09 AM   #1
Merlin
New Member
 
Join Date: Apr 2002
Posts: 6
Default

Can anyone advise on how to do a lookup that picks up the previous value in a column in a table ?

The value will be repeated several times in the table and I want to refer to the last occurrence. The table is not sorted and the most recent data is added to the bottom of the spreadsheet.

All the lookup funstions seem to pick up the first instance of the data - how do I get a reference to the last ?

Thanks
Merlin is offline   Reply With Quote
Old Apr 29th, 2002, 04:14 AM   #2
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Quote:
On 2002-04-29 03:09, Merlin wrote:
Can anyone advise on how to do a lookup that picks up the previous value in a column in a table ?

The value will be repeated several times in the table and I want to refer to the last occurrence. The table is not sorted and the most recent data is added to the bottom of the spreadsheet.

All the lookup funstions seem to pick up the first instance of the data - how do I get a reference to the last ?

Thanks
Care to provide a small sample of your data along with the expected result?

[ This Message was edited by: Aladin Akyurek on 2002-04-29 03:14 ]
Aladin Akyurek is offline   Reply With Quote
Old Apr 29th, 2002, 04:35 AM   #3
Merlin
New Member
 
Join Date: Apr 2002
Posts: 6
Default

Aladin -

I posted my data requirment, but I can't see where it went ?
Merlin is offline   Reply With Quote
Old Apr 29th, 2002, 04:39 AM   #4
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Quote:
On 2002-04-29 03:35, Merlin wrote:
Aladin -

I posted my data requirment, but I can't see where it went ?
Well, try again.
Aladin Akyurek is offline   Reply With Quote
Old Apr 29th, 2002, 04:41 AM   #5
Iain Lewis
Board Regular
 
Join Date: Apr 2002
Location: Midlands, UK
Posts: 217
Default

Try this formula :

=INDIRECT("a"&MATCH(c1,A2:A11,1)-1)

This assumes :
C1 contains the value which you want to match
The lookup range is A2 to A11
Iain Lewis is offline   Reply With Quote
Old Apr 29th, 2002, 04:52 AM   #6
Merlin
New Member
 
Join Date: Apr 2002
Posts: 6
Default

I'm trying to keep records for an archery club with the members' handicaps changing after every round that they shoot. The dat looks a bit like:

Name Round Date Handicap Score New H/cap

Smith FITA 05/02 35 925 33
Jones FITA 05/02 42 868 41
Brown Bray 15/02 48 246 49
Smith York 04/03 33 852 34
Brown York 04/03 49 775 48
Jones York 04/03 49 782 47
Smith Bray 15/03 33 275 32

I want the round that Smith shot on the 15/03 to refer back to the handicap held on 04/03 and not round shot on the 05/02. Every lookup that I've tried relates to the first instance in the list, not the previous occurrence.

Thanks
Merlin is offline   Reply With Quote
Old Apr 29th, 2002, 04:53 AM   #7
Merlin
New Member
 
Join Date: Apr 2002
Posts: 6
Default

Iain -

Thanks.

About to give it a try
Merlin is offline   Reply With Quote
Old Apr 29th, 2002, 05:17 AM   #8
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Quote:
On 2002-04-29 03:52, Merlin wrote:
I'm trying to keep records for an archery club with the members' handicaps changing after every round that they shoot. The dat looks a bit like:

Name Round Date Handicap Score New H/cap

Smith FITA 05/02 35 925 33
Jones FITA 05/02 42 868 41
Brown Bray 15/02 48 246 49
Smith York 04/03 33 852 34
Brown York 04/03 49 775 48
Jones York 04/03 49 782 47
Smith Bray 15/03 33 275 32

I want the round that Smith shot on the 15/03 to refer back to the handicap held on 04/03 and not round shot on the 05/02. Every lookup that I've tried relates to the first instance in the list, not the previous occurrence.

Thanks
Assume your sample data to be in A1:F8.

{"Name","Round","Date","Handicap","Score","New";
"Smith","FITA",37292,35,925,33;
"Jones","FITA",37292,42,868,41;
"Brown","Bray",37302,48,246,49;
"Smith","York",37319,33,852,34;
"Brown","York",37319,49,775,48;
"Jones","York",37319,49,782,47;
"Smith","Bray",37330,33,275,32}

In H2 enter: Smith [ your criterion player ]
In I1 enter: 15-Mar [ last shot date ]

The problem statement. Retrieve Smith's data on the last handicap before the one on 15-Mar.

In J1 enter:

=SUMPRODUCT(MAX(($A$2:$A$8=H2)*($C$2:$C$8
The above formula computes the row number of the row at which to look for Smith's data.

You can use the result to retrieve any piece of data related to the event. For example, to get the Round, simply use:

=INDEX(B:B,J2)


Note. If your data area is changing frequently, I'd suggest using dynamic name ranges in the formulas above instead of definite ranges and columns as in INDEX. If interested, just say so.

Aladin
Aladin Akyurek is offline   Reply With Quote
Old Apr 29th, 2002, 05:20 AM   #9
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Quote:
On 2002-04-29 03:41, Iain Lewis wrote:
Try this formula :

=INDIRECT("a"&MATCH(c1,A2:A11,1)-1)

This assumes :
C1 contains the value which you want to match
The lookup range is A2 to A11
That won't work with unsorted data & cannot cope with the query that wants the one before the last instance.

Aladin Akyurek is offline   Reply With Quote
Old Apr 29th, 2002, 06:02 AM   #10
Merlin
New Member
 
Join Date: Apr 2002
Posts: 6
Default

Aladin -

Thanks. I must be doing something wrong, because I just get 0 returned (cell F10).

={"Name","Start H/Cap","G/L/J","Round","Date","H/Cap for Round","Score",0,"Club Record","H/cap Shot","Allowance","Adj Score","New H/Cap";"Steve Potts",34,"G","Portsmouth",37353,34,560,0,574,31,889,1449,33;"Sally Potts",52,"L","Portsmouth",37353,52,465,0,562,54,967,1432,53;"Richard Darling",46,"G","Portsmouth",37353,46,505,0,574,46,935,1440,46;"Marilyn Vartoukian",34,"L","Portsmouth",37353,34,562,0,562,30,889,1451,32;"Kevin Ross",41,"G","Bray 1",37353,41,204,0,245,51,1201,1405,46;"John Gatenby",48,"G","Portsmouth",37353,48,460,0,574,54,945,1405,51;"Greg Vartoukian",34,"G","Portsmouth",37353,34,535,0,574,39,889,1424,37;"Andy Talbot",36,"G","Portsmouth",37353,0,542,0,574,37,840,1382,37}
Merlin is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 04:12 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes