Heroscapers

Heroscapers (https://www.heroscapers.com/community/index.php)
-   General (https://www.heroscapers.com/community/forumdisplay.php?f=26)
-   -   Need help with an MS Excel Script/Formula (https://www.heroscapers.com/community/showthread.php?t=24674)

Dennys April 29th, 2009 10:30 AM

Need help with an MS Excel Script/Formula
 
I'm working on a form for my job (A monthly mileage statement). We record end of day mileage from the bottom up in column A, and the daily use in column B. 31 lines on the form. So Day 1 is Cell A41. (There are header cells)

What I'd like to do is have Cell B40 and up scan down to the next filled A cell and subtract out the Current day's end from the prior day's end to give the actual use. Essentially B40=A40-A41. However it has to be smart enough to skip a null cell (weekends, days out, etc).

Do I need a script or can this be done in a straight formula in a cell?

Thanks
~Dennys

Onacara April 29th, 2009 10:44 AM

Re: Need help with an MS Excel Script/Formula
 
Quote:

Originally Posted by Dennys (Post 808563)
I'm working on a form for my job (A monthly mileage statement). We record end of day mileage from the bottom up in column A, and the daily use in column B. 31 lines on the form. So Day 1 is Cell A41. (There are header cells)

What I'd like to do is have Cell B40 and up scan down to the next filled A cell and subtract out the Current day's end from the prior day's end to give the actual use. Essentially B40=A40-A41. However it has to be smart enough to skip a null cell (weekends, days out, etc).

Do I need a script or can this be done in a straight formula in a cell?

Thanks
~Dennys

You could Conditionally Format it to count Null Cells as 0 can't you?

Dennys April 29th, 2009 10:51 AM

Re: Need help with an MS Excel Script/Formula
 
Quote:

Originally Posted by Onacara (Post 808579)
Quote:

Originally Posted by Dennys (Post 808563)
I'm working on a form for my job (A monthly mileage statement). We record end of day mileage from the bottom up in column A, and the daily use in column B. 31 lines on the form. So Day 1 is Cell A41. (There are header cells)

What I'd like to do is have Cell B40 and up scan down to the next filled A cell and subtract out the Current day's end from the prior day's end to give the actual use. Essentially B40=A40-A41. However it has to be smart enough to skip a null cell (weekends, days out, etc).

Do I need a script or can this be done in a straight formula in a cell?

Thanks
~Dennys

You could Conditionally Format it to count Null Cells as 0 can't you?

Probably, it wouldn't matter. I just need it to recognize the next valid odometer reading for the calculation.

SuperflyTNT April 29th, 2009 10:59 AM

Re: Need help with an MS Excel Script/Formula
 
pm me with your email address and I'll do it for you.

Aldin April 29th, 2009 11:00 AM

Re: Need help with an MS Excel Script/Formula
 
Can you use column C (or any hidden column) to run a mileage tally (=sum(c40+b39))? Then all you need to do is subtract c40 from c39 to get your daily total.

~Aldin, who suspects there is a formula, but usually cheaps out like this

SuperflyTNT April 29th, 2009 11:02 AM

Re: Need help with an MS Excel Script/Formula
 
Or use a second sheet as a 'crib note/calc' sheet...

nyys April 29th, 2009 11:04 AM

Re: Need help with an MS Excel Script/Formula
 
I know there's a COUNTBLANK function that might be helpful. Something along the lines of if the COUNTBLANK function = 1 then don't do the calculation.

Dennys April 29th, 2009 11:19 AM

Re: Need help with an MS Excel Script/Formula
 
Thanks for all the suggestions. I think I have it

B14 =IF(A14=0,0,(A14-LARGE(A15:A23,1)))

Logic: If Mileage input = 0 then Usage =0
Else Mileage = Existing Mielage -Largest (,1) (LARGE function) in
range of prior week's inputs (A15:A23) .

Turn off Zero results (non viewable)

Aldin April 29th, 2009 11:24 AM

Re: Need help with an MS Excel Script/Formula
 
That works (unless someone takes a week-long vacation) ;)

~Aldin, formulaicly

Dennys April 29th, 2009 02:39 PM

Re: Need help with an MS Excel Script/Formula
 
Yeah, I changed the second variable cell

B14 =IF(A14=0,0,(A14-LARGE(A15:$A$23,1)))

Where A23 represents the absolute lowest usable cell, so the search parameter will search from the current line to the entire bottom. Thanks for the catch.


All times are GMT -4. The time now is 04:33 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
User Alert System provided by Advanced User Tagging (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.