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 18th, 2002, 06:44 PM   #1
adamdalz
New Member
 
Join Date: Apr 2002
Posts: 1
Default

I have a logbook in excel. Included is a column with airplane names in it, and a column with dates when i flew those airplanes. What i'm looking for is a function that will tell me the date that i last flew a specific airplane.

For example, given

column 1 = piper, piper, zlin, piper, zlin
column 2 = may 10, may 12, may 13, may 15, may 16

I want a function that will look through the list and tell me I last flew a piper on may 15.

Thanks!

- Adam
adamdalz is offline   Reply With Quote
Old Apr 18th, 2002, 08:43 PM   #2
Yogi Anand
MrExcel MVP
 
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
Default

Quote:
On 2002-04-18 17:44, adamdalz wrote:
I have a logbook in excel. Included is a column with airplane names in it, and a column with dates when i flew those airplanes. What i'm looking for is a function that will tell me the date that i last flew a specific airplane.

For example, given

column 1 = piper, piper, zlin, piper, zlin
column 2 = may 10, may 12, may 13, may 15, may 16

I want a function that will look through the list and tell me I last flew a piper on may 15.

Thanks!

- Adam
Hi Adam:
Welcome to the board. One of the ways you can this is by using the DMAX function. Let us say your data is set up as follows
cell A1 ... Plane
cell A2 ... piper
cell A3 ... piper
cell A4 ... zin
cell A5 ... piper
cell a6 ... zin

cell B1 ... fly_date
cell B2 ... 5/10
cell B3 ... 5/12
cell B4 ... 5/13
cell B5 ... 5/15
cell B6 ... 5/16

then you want to put your criteria in cells D1:D2
in cell D1 ... Plane
in cell D2 ... piper

then the formula for the last date you flew piper:

=DMAX(A1:B6,2,D1:D2) ... giving you 5/15

HTH

Please post back if it works for you ... otherwise explain a little further and let us take it from there!


_________________
Yogi Anand
Edit: Deleted reference to inactive web site from signature line

[ This Message was edited by: Yogi Anand on 2003-01-19 18:30 ]
Yogi Anand is offline   Reply With Quote
Old Apr 18th, 2002, 08:50 PM   #3
robfo0
Board Regular
 
Join Date: Feb 2002
Location: Stockton, California
Posts: 281
Default

heres a quick macro, but it looks like yogi's solution is probably better, and easier So many functions, so little time to learn them all

Sub Fly_search()

planename = InputBox("Please input the name of the plane you are looking for:")
Range("A1").Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Key2:=Range("B1") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom

For Each i In Range("A1", Range("A65536").End(xlUp))
If i.Value = planename Then
If i.Offset(1, 0) <> planename Then flydate = i.Offset(0, 1)
End If
Next i
If flydate = "" Then
MsgBox ("plane not found")
Else
MsgBox ("The last date " & planename & " was flown was " & flydate)
End If
End Sub


[ This Message was edited by: robfo0 on 2002-04-18 19:52 ]
robfo0 is offline   Reply With Quote
Old Apr 18th, 2002, 10:06 PM   #4
Ice5
New Member
 
Join Date: Mar 2002
Posts: 9
Default

I'm "adamdalz" friend...

this past weekend I was trying to get the DMAX function to work but I just couldn't get the fields in the right order or something.

the DMAX function is a bit shifty.

Good to know I was on the right track though.

Now I undersand that in DMAX the first is the range to check, and the third is the criteria... what is the second field, (The '2' in this case)?

[ This Message was edited by: Ice5 on 2002-04-18 21:10 ]
Ice5 is offline   Reply With Quote
Old Apr 18th, 2002, 10:19 PM   #5
robfo0
Board Regular
 
Join Date: Feb 2002
Location: Stockton, California
Posts: 281
Default

the 2 is the column where the values are which you want to return, in this case you would have the database defined as A1:B6, B or the 2nd column contains the dates which you are looking for. if it were A1:C6, and c contained other data, and you were looking for something in that column, you would have a 3 instead of 2
robfo0 is offline   Reply With Quote
Old Apr 18th, 2002, 10:29 PM   #6
Yogi Anand
MrExcel MVP
 
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
Default

Hi Ice5:
To elaborate what robfo0 stated, 2 in the formula

=DMAX(A1:B6,2,D1:D2) is the number of column in the field in which the value being sought lies. I could also have substituted the field name in the formula instead of the associated column number, so the formula would have been...

=DMAX(A1:B6,"fly_date",D1:D2) and the result would have been the same 5/15

Regards!

Yogi anand
Yogi Anand 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 07:40 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