TIME IS TERRIBLE!!!!!!!!!!!!! HELP!!!!

%3CLINGO-SUB%20id%3D%22lingo-sub-2530543%22%20slang%3D%22en-US%22%3ETIME%20IS%20TERRIBLE!!!!!!!!!!!!!%20HELP!!!!%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2530543%22%20slang%3D%22en-US%22%3E%3CP%3EOk%20here%20is%20the%20deal.%20I%20need%20excel%20to%20do%20some%20simple%20math%20using%20complex%20logic.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20currently%20working%20on%20a%20transportation%20database.%20I%20need%20to%20track%202%20separate%20metrics%20here.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E1.%20Passenger%20Mileage%3C%2FP%3E%3CP%3E2.%20Passenger%20Time%3C%2FP%3E%3CP%3EThese%20metrics%20need%20to%20be%20tracked%20as%20%22Shared%22.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI.E.%20If%20a%20passenger%20is%20picked%20up%20at%209AM%20and%20dropped%20off%20at%2010AM%2C%20any%20mileage%20and%20time%20spent%20with%20this%20passenger%20is%20noted%20to%20that%20particular%20ride.%20However%20any%20passengers%20that%20are%20picked%20up%20or%20dropped%20off%20within%20the%20timeframe%20of%20another%20or%20within%20the%20mileage%20window%20of%20another%20is%20not%20counted.%26nbsp%3B%3C%2FP%3E%3CP%3ENow%2C%20if%20we%20were%20to%20pick%20up%20a%20passenger%20within%20the%20mileage%20and%20time%20window%2C%20but%20drop%20them%20off%20outside%20of%20that%20window%2C%20I%20would%20need%20to%20quantify%20the%20difference%20in%20mileage%20and%20time.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHere%20is%20the%20complex%20logic%20that%20I%20need%20excel%20to%20use...%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20the%20mileage%20formula%20figured%20out.%3C%2FP%3E%3CP%3E%3DIF(E5%26gt%3BMAX(%24F%243%3AF4)%2C%20SUM(F5-E5)%2C%20IF(F5%26gt%3BMAX(%24F%243%3AF4)%2C%20SUM(F5-MAX(%24F%243%3AF4))%2C%20%220%22))%3C%2FP%3E%3CP%3EThis%20provides%20me%20with%20the%20results%20that%20I%20need%20as%20our%20mileage%20is%20constantly%20accumulating.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20formula%20does%20not%20work%20in%20regards%20to%20tracking%20passenger%20time%20as%20the%20nature%20of%20time%20being%20cyclical%20doesn't%20lend%20well%20to%20the%20formula%20above.%20I%20am%20not%20a%20psychic%20and%20will%20never%20be%20able%20to%20know%20exactly%20how%20many%20riders%20will%20be%20provided%20services%20a%20day%2C%20so%20hard%20setting%20a%20formula%20to%20check%20a%20certain%20number%20of%20cells%20wont%20work.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20know%20that%20I%20can%20set%20a%20logic%20function%20to%20check%20if%20we%20are%20counting%20miles%20for%20the%20passenger%2C%20and%20base%20a%20formula%20on%20that.%20However%20I%20have%20spent%20well%20over%206%20HOURS%20today%20on%20trying%20to%20figure%20out%20how%20to%20tell%20excel%20to%20ignore%20shared%20time%20and%20provide%20me%20with%20the%20difference%20after%20time%20is%20no%20longer%20being%20shared%20with%20another%20rider%20during%20a%20specific%20date.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFor%20all%20I%20know%20what%20I%20am%20trying%20to%20do%20could%20be%20impossible%20for%20excel%2C%20(which%20I%20highly%20doubt).%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20anyone%20has%20any%20clue%20as%20to%20what%20I%20am%20trying%20to%20get%20excel%20to%20do%2C%20or%20if%20anyone%20has%20direct%20experience%20with%20this%20same%20concept%20of%20%22Shared%20time%22%20and%20%22Shared%20Miles%22%20I%20would%20greatly%20appreciate%20any%20help%20that%20you%20may%20be%20able%20to%20provie.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2530543%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ECharting%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2533582%22%20slang%3D%22en-US%22%3ERe%3A%20TIME%20IS%20TERRIBLE!!!!!!!!!!!!!%20HELP!!!!%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2533582%22%20slang%3D%22en-US%22%3E%3CP%3EI'm%20not%20sure%20I%20fully%20understand%20but%20here%20is%20my%20try%20at%20it.%3C%2FP%3E%3CP%3EFirst%20off%2C%20I%20think%20your%20equation%20has%20some%20minor%20issues.%20in%20the%20attached%20you%20refer%20to%20C%243%20instead%20of%20C%242%20and%20it%20is%20bad%20idea%20to%20use%20%220%22%20since%20that%20is%20text%20instead%20of%20a%20number.%3C%2FP%3E%3CP%3EHowever%2C%20since%20the%20data%20is%20always%20increasing%20with%20respect%20to%20pickup%20ODO%20and%20pickup%20time%20I%20think%20you%20can%20do%20this%20a%20little%20easier.%26nbsp%3B%20For%20the%20mileage%20I%20used%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DMAX(C2-MAX(C1%3AC%241%2CB2)%2C0)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3Ebasically%20the%20mileage%20is%20the%20destination%20ODO%20-%20the%20maximum%20any%20ODO%20recorded%20before%20or%20the%20pickup%20ODO%20but%20not%20less%20than%200%3C%2FP%3E%3CP%3Efor%20the%20time%20the%20equation%20is%20the%20exact%20same%20except%20I%20add%20the%20date%20to%20the%20time%20so%20that%20it%20keeps%20increasing%20day%20after%20day%20(and%20for%20this%20one%20it%20needed%20to%20start%20on%20row%203)%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DMAX((%24A3%2BE3)-MAX((%24A2%3A%24A%242%2BE2%3AE%242)%2C(%24A3%2BD3))%2C0)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Ok here is the deal. I need excel to do some simple math using complex logic. 

 

I am currently working on a transportation database. I need to track 2 separate metrics here. 

 

1. Passenger Mileage

2. Passenger Time

These metrics need to be tracked as "Shared".

 

I.E. If a passenger is picked up at 9AM and dropped off at 10AM, any mileage and time spent with this passenger is noted to that particular ride. However any passengers that are picked up or dropped off within the timeframe of another or within the mileage window of another is not counted. 

Now, if we were to pick up a passenger within the mileage and time window, but drop them off outside of that window, I would need to quantify the difference in mileage and time.

 

 

Here is the complex logic that I need excel to use...

 

I have the mileage formula figured out.

=IF(E5>MAX($F$3:F4), SUM(F5-E5), IF(F5>MAX($F$3:F4), SUM(F5-MAX($F$3:F4)), "0"))

This provides me with the results that I need as our mileage is constantly accumulating.

 

This formula does not work in regards to tracking passenger time as the nature of time being cyclical doesn't lend well to the formula above. I am not a psychic and will never be able to know exactly how many riders will be provided services a day, so hard setting a formula to check a certain number of cells wont work. 

 

I know that I can set a logic function to check if we are counting miles for the passenger, and base a formula on that. However I have spent well over 6 HOURS today on trying to figure out how to tell excel to ignore shared time and provide me with the difference after time is no longer being shared with another rider during a specific date.

 

For all I know what I am trying to do could be impossible for excel, (which I highly doubt). 

 

If anyone has any clue as to what I am trying to get excel to do, or if anyone has direct experience with this same concept of "Shared time" and "Shared Miles" I would greatly appreciate any help that you may be able to provie. 

 

1 Reply

I'm not sure I fully understand but here is my try at it.

First off, I think your equation has some minor issues. in the attached you refer to C$3 instead of C$2 and it is bad idea to use "0" since that is text instead of a number.

However, since the data is always increasing with respect to pickup ODO and pickup time I think you can do this a little easier.  For the mileage I used:

=MAX(C2-MAX(C1:C$1,B2),0)

basically the mileage is the destination ODO - the maximum any ODO recorded before or the pickup ODO but not less than 0

for the time the equation is the exact same except I add the date to the time so that it keeps increasing day after day (and for this one it needed to start on row 3):

=MAX(($A3+E3)-MAX(($A2:$A$2+E2:E$2),($A3+D3)),0)