Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 219
Default Is there a way...

to do this without going to VBA?

I track the Division vehicle for our group. Every 5,000 miles it needs an
oil change. I have a spreadsheet to track the mileage which I enter every
month near the end of the month.

Date Mileage Status
7/30/09 10,000 oil change
8/29/09 11,200
9/28/09 13,300
10/30/09 15,001

I'm trying to figure out if there is a way using a formula to tell me when
the difference between the latest mileage entry and the last oil change
mileage is greater than 5,000 miles, as it is in my example on 10/30.
(10/30 mileage is 15,001, last oil change was at 10,000). Or is this a job
for some VBA code?

I can write the code, just have it activated whenever a new mileage entry
is made and have it calculate the difference between the new mileage and
the previous oil change mileage and give me a Msgbox telling me when an oil
change is due. But I am wondering is it can be done with a formula. Not
sure how to tell it to find "oil change", or even the previous text entry
in that column, then do the calculation from that inside an if statement
having a message if the difference exceeds the 5,000. Anyone know how to do
this, or even if it's doable?

Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,718
Default Is there a way...

Assume Date in column A, Mileage in column B, and Status in column C

In E2: =IF(LOOKUP(10^10,B:B)-LOOKUP(2,1/(C:C="oil change"),B:B)5000,"need
oil change","")


"salgud" wrote:

to do this without going to VBA?

I track the Division vehicle for our group. Every 5,000 miles it needs an
oil change. I have a spreadsheet to track the mileage which I enter every
month near the end of the month.

Date Mileage Status
7/30/09 10,000 oil change
8/29/09 11,200
9/28/09 13,300
10/30/09 15,001

I'm trying to figure out if there is a way using a formula to tell me when
the difference between the latest mileage entry and the last oil change
mileage is greater than 5,000 miles, as it is in my example on 10/30.
(10/30 mileage is 15,001, last oil change was at 10,000). Or is this a job
for some VBA code?

I can write the code, just have it activated whenever a new mileage entry
is made and have it calculate the difference between the new mileage and
the previous oil change mileage and give me a Msgbox telling me when an oil
change is due. But I am wondering is it can be done with a formula. Not
sure how to tell it to find "oil change", or even the previous text entry
in that column, then do the calculation from that inside an if statement
having a message if the difference exceeds the 5,000. Anyone know how to do
this, or even if it's doable?

Thanks in advance.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 219
Default Is there a way...

On Tue, 25 Aug 2009 10:27:02 -0700, Teethless mama wrote:

Assume Date in column A, Mileage in column B, and Status in column C

In E2: =IF(LOOKUP(10^10,B:B)-LOOKUP(2,1/(C:C="oil change"),B:B)5000,"need
oil change","")

Thanks for your reply. I'm getting a #NUM error on the term (C:C="oil
change"). Any ideas?

If you have the time, can you explain the LOOKUP(2,1/(C:C="oil change")
part of the equation? What is the reciprocal of the (C:C="oil change")?
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default Is there a way...

You can only use the entire column in xl2007.

So use a range that's big enough for your data:

=IF(LOOKUP(10^10,B1:B111)-LOOKUP(2,1/(C1:C111="oil change"),B1:B111)5000,
"need oil change","")



salgud wrote:

On Tue, 25 Aug 2009 10:27:02 -0700, Teethless mama wrote:

Assume Date in column A, Mileage in column B, and Status in column C

In E2: =IF(LOOKUP(10^10,B:B)-LOOKUP(2,1/(C:C="oil change"),B:B)5000,"need
oil change","")

Thanks for your reply. I'm getting a #NUM error on the term (C:C="oil
change"). Any ideas?

If you have the time, can you explain the LOOKUP(2,1/(C:C="oil change")
part of the equation? What is the reciprocal of the (C:C="oil change")?


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 219
Default Is there a way...

On Tue, 25 Aug 2009 15:17:30 -0500, Dave Peterson wrote:

You can only use the entire column in xl2007.

So use a range that's big enough for your data:

=IF(LOOKUP(10^10,B1:B111)-LOOKUP(2,1/(C1:C111="oil change"),B1:B111)5000,
"need oil change","")



salgud wrote:

On Tue, 25 Aug 2009 10:27:02 -0700, Teethless mama wrote:

Assume Date in column A, Mileage in column B, and Status in column C

In E2: =IF(LOOKUP(10^10,B:B)-LOOKUP(2,1/(C:C="oil change"),B:B)5000,"need
oil change","")

Thanks for your reply. I'm getting a #NUM error on the term (C:C="oil
change"). Any ideas?

If you have the time, can you explain the LOOKUP(2,1/(C:C="oil change")
part of the equation? What is the reciprocal of the (C:C="oil change")?


Thanks, Dave. Works great!


  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,104
Default Is there a way...

Here is one way
date miles since change change warning
07/30/2009 10,000 0 X07/31/2009 11,200
120008/01/2009 13,300
330008/02/2009 15,001
0 X08/03/2009 16,702
170108/04/2009 18,403
340208/05/2009 20,104
5103 Oil change needed

In C2 (cell under "since change") I have this formula
=B2-MAX(IF($D$2:D2="X",$B$2:B2))
This is copied down the column
In E2 (under "warning" I have
=IF(C2=5000,"Oil change needed","")
this is copied down the column
You could hide column C to make worksheet look better
Email me (get my address from my website) and I will send you sample file
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email


"salgud" wrote in message
...
to do this without going to VBA?

I track the Division vehicle for our group. Every 5,000 miles it needs an
oil change. I have a spreadsheet to track the mileage which I enter every
month near the end of the month.

Date Mileage Status
7/30/09 10,000 oil change
8/29/09 11,200
9/28/09 13,300
10/30/09 15,001

I'm trying to figure out if there is a way using a formula to tell me when
the difference between the latest mileage entry and the last oil change
mileage is greater than 5,000 miles, as it is in my example on 10/30.
(10/30 mileage is 15,001, last oil change was at 10,000). Or is this a job
for some VBA code?

I can write the code, just have it activated whenever a new mileage entry
is made and have it calculate the difference between the new mileage and
the previous oil change mileage and give me a Msgbox telling me when an
oil
change is due. But I am wondering is it can be done with a formula. Not
sure how to tell it to find "oil change", or even the previous text entry
in that column, then do the calculation from that inside an if statement
having a message if the difference exceeds the 5,000. Anyone know how to
do
this, or even if it's doable?

Thanks in advance.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 04:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"