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 27th, 2002, 01:23 PM   #1
Beckwa
New Member
 
Join Date: Mar 2002
Location: Northampton, UK
Posts: 33
Default

Ok, for my spreadsheet for a taxi company I have a cell for "base charge" and one for "price for mile". I want these prices to be dependent on a Vlookup which refers to a lookup prices table. The prices change according to the current time. I tried a Vlookup but that doesn't include the fact that it should be referring to the time before looking up the appropriate value. Any ideas? Am I even speaking English anymore?!?!? B
Beckwa is offline   Reply With Quote
Old Apr 27th, 2002, 01:39 PM   #2
Yogi Anand
MrExcel MVP
 
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
Default

Quote:
On 2002-04-27 12:23, Beckwa wrote:
Ok, for my spreadsheet for a taxi company I have a cell for "base charge" and one for "price for mile". I want these prices to be dependent on a Vlookup which refers to a lookup prices table. The prices change according to the current time. I tried a Vlookup but that doesn't include the fact that it should be referring to the time before looking up the appropriate value. Any ideas? Am I even speaking English anymore?!?!? B
Hi Beckwa:
You have spoken EXCELent English but you have taken us for a ride by withholding some essential details. Please post a sample of your data and what formula you are using ... and then let us take it from there!


__________________
Regards!

Yogi Anand, D.Eng, P.E.
Energy Efficient Building Network LLC
www.energyefficientbuild.com
Yogi Anand is offline   Reply With Quote
Old Apr 27th, 2002, 01:58 PM   #3
Beckwa
New Member
 
Join Date: Mar 2002
Location: Northampton, UK
Posts: 33
Default

What more do you need to know then? I basically want it to say"If BookingTime is greater than 10:00 but less than 16:00 then (VLOOKUP PART) lookup the table and pull off the relevant price, if it's greater than 16:01 but less than 22:00 then lookup table and pull off relevant price etc etc. Now i know i'm not speaking english!!! B
Beckwa is offline   Reply With Quote
Old Apr 27th, 2002, 02:29 PM   #4
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Quote:
On 2002-04-27 12:58, Beckwa wrote:
What more do you need to know then? I basically want it to say"If BookingTime is greater than 10:00 but less than 16:00 then (VLOOKUP PART) lookup the table and pull off the relevant price, if it's greater than 16:01 but less than 22:00 then lookup table and pull off relevant price etc etc. Now i know i'm not speaking english!!! B
First set up a 2-column list like this one:

{0.417361111111111,2;
0.667361111111111,3;
0.834027777777778,4}

The longish looking numbers are really times corresponding to;

10:01
16:01
20:01

and small numbers are prices per mile.

Select all cells of this list, go to the Name Box on the Formula Bar, type PriceList, and hit enter.

Put the base charge in some cell, select this cell, and name it BaseCharge, following the foregoing procedure.

You could then use something like this:

=BaseCharge+E1*VLOOKUP(F1,PriceList,2)

where E1 houses a miles reading and F a booking time.




[ This Message was edited by: aladin akyurek on 2002-04-27 14:01 ]
Aladin Akyurek is offline   Reply With Quote
Old Apr 27th, 2002, 02:35 PM   #5
Yogi Anand
MrExcel MVP
 
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
Default

OK Beckwa:
Set up a tableof rates and times, say in cells A1:B5 as shown below ...

Time Rate
0:01 1.25
10:01 1.55
16:01 1.85
22:01 1.95

then let us say you want to lookup at a rate that applies to a time frame that's less than 16:01, use the following formula:

=VLOOKUP(timevalue("16:00"),$A$1:$B$5,2,1)
this will give you a rate of 1.55

now let us look at the rate that applies to a time frame 16:01 or later

=VLOOKUP(timevalue("16:01"),$A$1:$B$5,2,1)
this will give you 1.85

HTH

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


__________________
Regards!

Yogi Anand, D.Eng, P.E.
Energy Efficient Building Network LLC
www.energyefficientbuild.com
Yogi Anand is offline   Reply With Quote
Old Apr 27th, 2002, 02:56 PM   #6
Beckwa
New Member
 
Join Date: Mar 2002
Location: Northampton, UK
Posts: 33
Default

Ok, i'm obviousoy doing soemthing wrong, i emailed the workbook to u Yogi, don't know if that will help cos i'm totally lost now!! B
Beckwa is offline   Reply With Quote
Old Apr 27th, 2002, 03:23 PM   #7
Yogi Anand
MrExcel MVP
 
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
Default

Quote:
On 2002-04-27 13:56, Beckwa wrote:
Ok, i'm obviousoy doing soemthing wrong, i emailed the workbook to u Yogi, don't know if that will help cos i'm totally lost now!! B
OK Becky:
I have looked at your worksheet ... I had to make some minor adjustments in your worksheet to make it work.
The time function you are using is NOW(), so we dont have to use TIMEVALUE(BookingTime); the other thing I had to was to refere to your Prices Table worksheet. So now in the Booking Form, the formula that you use for Base Charge is now:

=VLOOKUP(NOW(),'Prices Table'!$A$1:$B$5,2,1)

so now with my local time 17:19, the formula results in 2.00 Pounds (since I am in the United States, I don't want to under charge you and state $2.00)

Please adjust your Prices Table values and every other item accordingly. I have only looked at the formula you wanted, and not the make up of the rest of your workbook.

HTH

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




__________________
Regards!

Yogi Anand, D.Eng, P.E.
Energy Efficient Building Network LLC
www.energyefficientbuild.com
Yogi Anand is offline   Reply With Quote
Old Apr 27th, 2002, 03:46 PM   #8
Beckwa
New Member
 
Join Date: Mar 2002
Location: Northampton, UK
Posts: 33
Default

Ok this kinda works but it's still not quite what i want. If I change the time to 13:45 for example - it still says £2.00?!?! If u look at the table it shows that it should say £1.40 as it is after 10:00 and before 16:00. B
Beckwa is offline   Reply With Quote
Old Apr 27th, 2002, 03:54 PM   #9
Yogi Anand
MrExcel MVP
 
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
Default

Quote:
On 2002-04-27 14:46, Beckwa wrote:
Ok this kinda works but it's still not quite what i want. If I change the time to 13:45 for example - it still says £2.00?!?! If u look at the table it shows that it should say £1.40 as it is after 10:00 and before 16:00. B
Hi Becky:
For this to work with NOW() function as well as a manual time entry, just change the formula to ...

=VLOOKUP(BookingTime,'Prices Table'!$A$1:$B$5,2,1)

Regards!

Yogi Anand


Yogi Anand is offline   Reply With Quote
Old Apr 27th, 2002, 03:58 PM   #10
Beckwa
New Member
 
Join Date: Mar 2002
Location: Northampton, UK
Posts: 33
Default

There won't be any manual time entry, well hopefully anyway. What i mean is, as a test i changed the time on my computer to 13:45 instead of 22:45. In theory this means the base charge should change to a cheaper rate through the lookup but it didn't!!! Thanks for all ur help, B
Beckwa 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 10:24 AM.


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