SOLVED

Toggle Day Counter

%3CLINGO-SUB%20id%3D%22lingo-sub-1784267%22%20slang%3D%22en-US%22%3EToggle%20Day%20Counter%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1784267%22%20slang%3D%22en-US%22%3E%3CP%3EHey%20Everyone!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20need%20some%20help.%20%3CLI-EMOJI%20id%3D%22lia_disappointed-face%22%20title%3D%22%3Adisappointed_face%3A%22%3E%3C%2FLI-EMOJI%3E%20I%20am%20trying%20to%20track%20accumulative%20days%20a%20piece%20of%20equipment%20is%20not%20operating.%20I%20want%20this%20to%20be%20as%20automated%20as%20possible%20and%20would%20like%20maybe%20some%20sort%20of%20toggle%20function%20that%20I%20would%20switch%20on%2Foff%20(or%20operating%2Fnot%20operating)%20and%20excel%20counts%20how%20many%20days%20the%20toggle%20was%20in%20the%20%22off%22%20position%20from%20%22start%20date%22%20that%20I%20would%20have%20manually%20entered%20and%20%22Todays%22%20Date.%20I%20feel%20like%20this%20is%20possible%20maybe%20with%20some%20kind%20of%20CountIF%20formula%20but%20I%20do%20not%20know%20how%20to%20make%20sure%20it%20accumulates%20all%20the%20times%20it%20was%20switched%20off%20or%20add%20together%20the%20durations%20of%20those%20%22off%22%20times%20and%20not%20restart%20the%20count%20every%20time%20the%20toggle%20switches.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20follow%20that%2C%20it%20would%20need%20to%20be%20able%20to%20be%20set%20back%20or%20have%20a%20spot%20where%20I%20can%20manually%20tell%20it%20when%20to%20start%20its%20%22off%22%20position%20counting%20just%20in%20case%20I%20am%20unable%20to%20go%20in%20on%20the%20exact%20day%20its%20out%20of%20commission%20and%20update%20the%20spreadsheet.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20other%20ideas%20for%20this%20are%20more%20than%20welcome%20-%20I%20mainly%20need%20minimal%20input%20or%20data%20entry%20on%20my%20end%20and%20for%20it%20to%20accumulate%20ALL%20days%20the%20equipment%20was%20not%20operating.%20It%20doesn't%20have%20to%20look%20fancy%20or%20actually%20be%20a%20button%20or%20anything%20like%20that.%20I%20just%20need%20it%20to%20count.%20I%20plan%20on%20referencing%20the%20final%20count%20cell%20on%20another%20sheet%20that%20will%20be%20for%20presentation%20purposes.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20y'all%20so%20much%20for%20your%20help!%20%3CLI-EMOJI%20id%3D%22lia_red-heart%22%20title%3D%22%3Ared_heart%3A%22%3E%3C%2FLI-EMOJI%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1784267%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1785083%22%20slang%3D%22en-US%22%3ERe%3A%20Toggle%20Day%20Counter%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1785083%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F833831%22%20target%3D%22_blank%22%3E%40TSawyer1226%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESpeaking%20in%20the%20abstract%2C%20which%20is%20about%20all%20I%20can%20do%20at%20this%20point%2C%20I%20think%20what%20you're%20asking%20is%20fairly%20straightforward.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20you'd%20like%20something%20less%20abstract%2C%20it%20would%20help%20a%20lot%20(A%20LOT!)%20if%20you%20posted%20a%20copy%2C%20or%20some%20facsimile%20thereof%2C%20of%20the%20specific%20spreadsheet%20you're%20working%20with%2C%20showing%20how%20you%20have%20your%20data%20organized.%20Also%20let%20us%20know%20which%20version%20of%20Excel%20you're%20working%20with%3B%20there%20are%20some%20features%20in%20the%20newest%20release%20of%20Excel%20that%20might%20be%20relevant%2C%20so%20it%20would%20be%20good%20to%20know%20if%20that's%20what%20you%20have.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1785641%22%20slang%3D%22en-US%22%3ERe%3A%20Toggle%20Day%20Counter%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1785641%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F425987%22%20target%3D%22_blank%22%3E%40mathetes%3C%2FA%3E%26nbsp%3BAwesome!%20that's%20good%20to%20hear.%20I%20have%20attached%20my%20file.%20I%20have%20a%20reference%20sheet%20where%20I%20picture%20this%20counter%20to%20be%20placed%20(highlighted%20in%20yellow%20for%20you)%20and%20I%20planned%20for%20the%20total%20count%20days%20to%20be%20referenced%20from%20there%20onto%20the%20two%20Data%20Base%20sheets%20as%20needed%20for%20Calendar%20and%20Operating%20Days.%20Those%20two%20pages%20are%20my%20data%20input%20pages.%20That's%20where%2099%25%20of%20my%20data%20is%20inputted.%20The%20other%20Rig%20specific%20sheets%20are%20linked%20to%20the%20data%20base%20pages%20and%20are%20meant%20to%20just%20be%20refreshed%20and%20printed%20only.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20help%20or%20recommendations%20to%20rework%20the%20sheets%20as%20needed%20to%20make%20the%20counter%20work%20or%20formula's%20to%20work%20better%20I%20am%20willing%20to%20look%20into%20and%20see%20how%20it%20fits%20overall.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1786050%22%20slang%3D%22en-US%22%3ERe%3A%20Toggle%20Day%20Counter%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1786050%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F833831%22%20target%3D%22_blank%22%3E%40TSawyer1226%3C%2FA%3E%26nbsp%3B%20So%20the%20only%20way%20to%20do%20this%20is%20with%20a%20macro.%26nbsp%3B%20i%20created%20a%20sheet%20with%20checkboxes%20that%20can%20be%20clicked%20ON%20and%20OFF%20to%20signify%20the%20machine%20is%20ON%20or%20OFF.%26nbsp%3B%20Each%20time%20it%20will%20log%20that%20time%20onto%20an%20ongoing%20list%20of%20ON%20and%20OFF%20times.%26nbsp%3B%20I%20then%20have%20a%20table%20to%20calculate%20the%20total%20ON%20and%20total%20OFF%20times.%26nbsp%3B%20Note%20that%20those%20total%20times%20are%20updated%20when%20a%20change%20triggers%20a%20new%20calculation%20so%20if%20the%20machine%20is%20presently%20OFF%20that%20formula%20updates%20the%20total%20OFF%20time%20based%20on%20the%20time%20right%20now.%26nbsp%3B%20You%20can%20change%20the%20time%20format%20to%20be%20days%20instead%20(i.e.%20integer%20numbers%20would%20work%20to%20signify%20days).%26nbsp%3B%20I%20am%20also%20attaching%20a%20drawing%20on%20how%20I%20added%20a%202nd%20rig%20so%20you%20can%20add%20the%203rd%2C%204th%2C%20etc...%3C%2FP%3E%3CP%3EHope%20this%20helps%20you.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1788694%22%20slang%3D%22en-US%22%3ERe%3A%20Toggle%20Day%20Counter%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1788694%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F570951%22%20target%3D%22_blank%22%3E%40mtarler%3C%2FA%3E%26nbsp%3BYOU.%20ARE.%20AMAZING.%26nbsp%3B%3C%2FP%3E%3CP%3EI%20believe%20this%20will%20work%20for%20what%20I%20need%20it%20to%20do.%20I%20will%20try%20it%20out%20and%20let%20you%20know%20if%20I%20have%20any%20issues.%20Thank%20you%20so%20much%20for%20your%20time%20and%20help%20on%20this!%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1788997%22%20slang%3D%22en-US%22%3ERe%3A%20Toggle%20Day%20Counter%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1788997%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F570951%22%20target%3D%22_blank%22%3E%40mtarler%3C%2FA%3E%26nbsp%3BI%20actually%20do%20have%20a%20small%20question%20(I%20know%2C%20that%20didn't%20take%20very%20long%20lol).%20Where%20would%20I%20go%20or%20what%20do%20I%20click%20to%20turn%20the%20macro%20off%3F%20In%20the%20case%20something%20gets%20decommissioned%20I%20would%20like%20for%20it%20just%20stop%20counting%20without%20me%20losing%20all%20the%20data%20it%20had%20recorded%20up%20to%20that%20point.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1789088%22%20slang%3D%22en-US%22%3ERe%3A%20Toggle%20Day%20Counter%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1789088%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F833831%22%20target%3D%22_blank%22%3E%40TSawyer1226%3C%2FA%3E%26nbsp%3B%20Just%20delete%20the%20checkbox.%26nbsp%3B%20No%20checkbox%2C%20no%20call%20to%20the%20macro.%26nbsp%3B%20Note%20that%20I%20only%20wrote%201%20macro%20(to%20rule%20them%20all%2C%20lol).%20So%20the%20macro%20will%20get%20the%20NAME%20of%20the%20checkbox%20(you%20can%20find%20and%20change%20it%20in%20the%20box%20to%20the%20left%20of%20the%20equation%20editor%20box)%20calling%20it%20and%20use%20that%20to%20know%20which%20list%20to%20update.%26nbsp%3B%20So%20if%2Fwhen%20you%20copy%20the%20checkbox%20you%20much%20change%20that%20name%20and%20the%20CAPTION%20(the%20text%20next%20to%20the%20checkbox)%20or%20else%20when%20you%20click%20that%20checkbox%20it%20will%20add%20the%20timestamp%20on%20the%20wrong%20list.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hey Everyone!

 

I need some help. I am trying to track accumulative days a piece of equipment is not operating. I want this to be as automated as possible and would like maybe some sort of toggle function that I would switch on/off (or operating/not operating) and excel counts how many days the toggle was in the "off" position from "start date" that I would have manually entered and "Todays" Date. I feel like this is possible maybe with some kind of CountIF formula but I do not know how to make sure it accumulates all the times it was switched off or add together the durations of those "off" times and not restart the count every time the toggle switches.

 

To follow that, it would need to be able to be set back or have a spot where I can manually tell it when to start its "off" position counting just in case I am unable to go in on the exact day its out of commission and update the spreadsheet.

 

Any other ideas for this are more than welcome - I mainly need minimal input or data entry on my end and for it to accumulate ALL days the equipment was not operating. It doesn't have to look fancy or actually be a button or anything like that. I just need it to count. I plan on referencing the final count cell on another sheet that will be for presentation purposes.

 

Thank y'all so much for your help!

 

10 Replies

@TSawyer1226 

 

Speaking in the abstract, which is about all I can do at this point, I think what you're asking is fairly straightforward.

 

If you'd like something less abstract, it would help a lot (A LOT!) if you posted a copy, or some facsimile thereof, of the specific spreadsheet you're working with, showing how you have your data organized. Also let us know which version of Excel you're working with; there are some features in the newest release of Excel that might be relevant, so it would be good to know if that's what you have.

@mathetes Awesome! that's good to hear. I have attached my file. I have a reference sheet where I picture this counter to be placed (highlighted in yellow for you) and I planned for the total count days to be referenced from there onto the two Data Base sheets as needed for Calendar and Operating Days. Those two pages are my data input pages. That's where 99% of my data is inputted. The other Rig specific sheets are linked to the data base pages and are meant to just be refreshed and printed only. 

 

Any help or recommendations to rework the sheets as needed to make the counter work or formula's to work better I am willing to look into and see how it fits overall. 

 

Thanks!

best response confirmed by TSawyer1226 (Occasional Contributor)
Solution

@TSawyer1226  So the only way to do this is with a macro.  i created a sheet with checkboxes that can be clicked ON and OFF to signify the machine is ON or OFF.  Each time it will log that time onto an ongoing list of ON and OFF times.  I then have a table to calculate the total ON and total OFF times.  Note that those total times are updated when a change triggers a new calculation so if the machine is presently OFF that formula updates the total OFF time based on the time right now.  You can change the time format to be days instead (i.e. integer numbers would work to signify days).  I am also attaching a drawing on how I added a 2nd rig so you can add the 3rd, 4th, etc...

Hope this helps you. 

@mtarler YOU. ARE. AMAZING. 

I believe this will work for what I need it to do. I will try it out and let you know if I have any issues. Thank you so much for your time and help on this! 

@mtarler I actually do have a small question (I know, that didn't take very long lol). Where would I go or what do I click to turn the macro off? In the case something gets decommissioned I would like for it just stop counting without me losing all the data it had recorded up to that point. 

@TSawyer1226  Just delete the checkbox.  No checkbox, no call to the macro.  Note that I only wrote 1 macro (to rule them all, lol). So the macro will get the NAME of the checkbox (you can find and change it in the box to the left of the equation editor box) calling it and use that to know which list to update.  So if/when you copy the checkbox you much change that name and the CAPTION (the text next to the checkbox) or else when you click that checkbox it will add the timestamp on the wrong list.

 

@mtarler Perfect! it has been a short adventure lol but thank you again for all of your help.

@TSawyer1226  Hello again.  I have updated your newest sheet with a couple tweaks I think you will like.  I deleted all the redundant buttons (nice macros btw).  I reduced to 1 button per row.  I 'hide' the timestamp behind the button and then add the difference between NOW and that timestamp whenever it is changed from Operating to Not Operating.  Note that it only updates the Operating Count (Hidden) when you click the button so I added a 'running clock' condition to the Operation Days column so if the button is 'Operating' it will update the 'Operating Days' status on each refresh (FYI - having many rows can cause it to lag as it has to update every cell in the row on every entry/refresh anywhere on the page).  I did not try to make the button different colors but the text does change

BTW - I responded here so that your new request can stay 'unanswered' and maybe get another solution from another volunteer.

best of luck.

@mtarler  Hello Hello. I seriously hope you get paid to be this freaking good. I just tested it out over the last day and I believe this is it! (I am totally doing a happy dance right now lol). Thank you again for all your help, the changes you made look wonderful and they do what I need them to. 

 

P.S I am glad you like the macros lol I am still a noob when it comes to that stuff but glad I was in the right ballpark. 

@TSawyer1226  You  are very welcome and very happy it is helpful.  No I/we are just volunteers here and this isn't even directly related to my real job (I use excel but just like you or anyone else in business. i.e. not a consultant).  My payment is knowing I helped someone and seeing my Likes and Best Responses tick up