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 5th, 2002, 10:09 AM   #1
Harley
New Member
 
Join Date: Feb 2002
Posts: 25
Default

Column A contains different commercial titles (Nike 1, Nike 2, Nike 3, etc.). Column B contains a single date that the commercial aired on. For example:

A B
Nike 1 01/02/02
Nike 1 03/01/02
Nike 1 02/26/02
Nike 2 12/31/01
Nike 2 5/14/01
Nike 3 6/12/01
Nike 3 12/13/01
Nike 3 11/4/01

How can I create a formula that will return a first air date and last air date for each commercial? I need the formula to look at all the dates in column B for each different commercial and return the earliest air date and the most recent air date.

In the above example, the formula would return for "Nike 1" First Air Date - 1/2/02, Last Air Date - 3/1/02

I could sort by A then by B and manually look up the first and last air dates but that would take too long considering there are thousands of dates to scroll through for each commercial.

[ This Message was edited by: Harley on 2002-04-05 09:10 ]

[ This Message was edited by: Harley on 2002-04-05 09:11 ]

[ This Message was edited by: Harley on 2002-04-05 09:11 ]
Harley is offline   Reply With Quote
Old Apr 5th, 2002, 11:00 AM   #2
Jay Petrulis
MrExcel MVP
 
Jay Petrulis's Avatar
 
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
Default

Quote:
On 2002-04-05 09:09, Harley wrote:
Column A contains different commercial titles (Nike 1, Nike 2, Nike 3, etc.). Column B contains a single date that the commercial aired on. For example:

A B
Nike 1 01/02/02
Nike 1 03/01/02
Nike 1 02/26/02
Nike 2 12/31/01
Nike 2 5/14/01
Nike 3 6/12/01
Nike 3 12/13/01
Nike 3 11/4/01

How can I create a formula that will return a first air date and last air date for each commercial? I need the formula to look at all the dates in column B for each different commercial and return the earliest air date and the most recent air date.

In the above example, the formula would return for "Nike 1" First Air Date - 1/2/02, Last Air Date - 3/1/02

I could sort by A then by B and manually look up the first and last air dates but that would take too long considering there are thousands of dates to scroll through for each commercial.

[ This Message was edited by: Harley on 2002-04-05 09:10 ]

[ This Message was edited by: Harley on 2002-04-05 09:11 ]

[ This Message was edited by: Harley on 2002-04-05 09:11 ]
Hi Harley,

I used A1:B8 for your data supplied.

In C1 I placed the text, "Nike 1"
In C2, "Nike 2"
In C3, "Nike 3"

In D1 I placed the following array-entered formula

=MIN(IF($A$1:$A$8=C1,$B$1:$B$8))

You must enter this with Ctrl+Shift+Enter, rather than just Enter. You will see Excel generated braces {} surrounding the formula if done correctly.

In E1, I array-entered the following

=MAX(IF($A$1:$A$8=C1,$B$1:$B$8))

I copied down the range to fill in the rest.

Please adjust your range as needed.

If you need this with your text in one cell, use something like:

=C1& " first aired on " & TEXT(MIN(IF($A$1:$A$8=C1,$B$1:$B$8)),"d/m/yy") & ", last aired on " & TEXT(MAX(IF($A$1:$A$8=C1,$B$1:$B$8)),"d/m/yy")

also array enetered.

Bye,
Jay
Jay Petrulis is offline   Reply With Quote
Old Apr 5th, 2002, 11:32 AM   #3
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Quote:
On 2002-04-05 09:09, Harley wrote:
Column A contains different commercial titles (Nike 1, Nike 2, Nike 3, etc.). Column B contains a single date that the commercial aired on. For example:

A B
Nike 1 01/02/02
Nike 1 03/01/02
Nike 1 02/26/02
Nike 2 12/31/01
Nike 2 5/14/01
Nike 3 6/12/01
Nike 3 12/13/01
Nike 3 11/4/01

How can I create a formula that will return a first air date and last air date for each commercial? I need the formula to look at all the dates in column B for each different commercial and return the earliest air date and the most recent air date.

In the above example, the formula would return for "Nike 1" First Air Date - 1/2/02, Last Air Date - 3/1/02

I could sort by A then by B and manually look up the first and last air dates but that would take too long considering there are thousands of dates to scroll through for each commercial.

[ This Message was edited by: Harley on 2002-04-05 09:10 ]

[ This Message was edited by: Harley on 2002-04-05 09:11 ]

[ This Message was edited by: Harley on 2002-04-05 09:11 ]
Lets say that A1:B9 houses your sample data including added headings:

{"Titles","Comm Dates";
"Nike 1",37258;
"Nike 1",37316;
"Nike 1",37313;
"Nike 2",37256;
"Nike 2",37025;
"Nike 3",37054;
"Nike 3",37238;
"Nike 3",37199}

The big numbers are just dates in the internal representation that Excel uses, so don't be alarmed.

Prerequisite: The data must be sorted on column A.

Create a unique list of titles (using e.g., Advanced Filter) in D from D2 on including the column heading "Titles".

In D1 enter:

=MATCH(9.99999999999999E+307,B:B)

In E2:F2 enter:

{"First Air Date","Last Air Date"}

In E3 enter:

=OFFSET($B$2,MATCH(D3,OFFSET($A$2,0,0,$D$1-1,1),0)-1,0,1)

In F3 enter:

=OFFSET($B$2,MATCH(D3,OFFSET($A$2,0,0,$D$1-1,1))-1,0,1)

Select E3:F3 and copy down as far as needed.

This is what you get to see in the results area, that is, D1:F5 regarding the sample data:

{9,"","";
"Titles","First Air Date","Last Air Date";
"Nike 1",37258,37313;
"Nike 2",37256,37025;
"Nike 3",37054,37199}

You don't need to adjust the formulas when you add to or delete from the data area titles and dates associated with them.

Aladin
Aladin Akyurek is offline   Reply With Quote
Old Apr 5th, 2002, 11:56 AM   #4
Harley
New Member
 
Join Date: Feb 2002
Posts: 25
Default

Jay...that works great...this will save loads of time...thanks
Harley 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 12:38 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