Formatting Cells to highlight after a specific time period has elapsed - scripting

I am trying to resolve an issue regarding my workplace in google sheets. I am looking to highlight cells in a specific column after a specific time has elapsed. This column is going to consist of time stamps. What I am trying to do is once 15 minutes of the cell's timestamp to highlight it red as a notifier for the user of the sheet to proceed with a process. There is no way to do this with normal Conditional formatting and look clean. I am not sure as to where to start other than I can basically do this by making a script using Google Sheets script editor. I just need a push in the direction.
I have looked into normal Conditional Formatting built into Google Sheets and it can be done but you would have an End Time Column basically incremented 15 minutes after the original time stamp using the today() formula. However this is cluttered and ideally isn't as seemless I would like it to be.
I am looking to write a script to automatically highlight the timestamp red once the current time is at least 15 minutes or older. Without the end column it doesn't work and ultimately I am trying to keep from having extra columns when they are not needed. I am not sure where to start. Just looking for opinions on how to start this.

Related

Job/Work scheduler/planner for teams

Currently we use an excel spreadsheet with 4 tabs (as tab for each team), each tab is a planner/diary that week, each day has 4 "slots" for jobs that are planned in.
The people type in the information for each job into one of the 4 slotsfor the day. Each slot contains information in different cells; Job No., Address, Duration, Notes, etc...
The issue/time consuming aspect of this method is when jobs have to be moved about between teams or moved to a different day it involves lots of copying, pasting and deleting.
What I am trying to achieve is some form of drag/drop interface (similar to the way the calendar in Outlook works), where the people who use the spreadsheet can input details for the job in a form and then have a drag an drop "tile" to be able to drag into one of the "slots.
The data contained in these slots needs to be able to produce a report which is a linear list of all the jobs planned that week.
I am at a loss to figure out what method I should use to create this, it seems it is beyond the reach of Excel from what I can find, also beyond the reach of Access, so I suspect it will involve some form of programming. I have basic understanding of VBA, but that's about it.
Can anyone make any suggestions.
Thanks
Working with data in this format will always be hard and I would not reccomend adding any drag and drop until you have sorted out the structure of your data.
You might like to consider another approach, which involves restructuring your data to make it easier to work with...
If you had one sheet with the following columns:
Teamname
Date (instead of Week Number and Day of week,)
Timeslot
JobNo
Address
Duration
Notes
Etc
Then each row would represent a job and have details of when it is occurring.
This is way a database would store the information about the jobs that are happening.
To change when a job is happening, all you have to do is update the date (and timeslot) of the row.
You could then create another worksheet for each team that uses excel formulas to lookup jobs happening this week and display them in a column for each day - like you have now. These sheets would be for display purposes only.
(You would use formulas like VLOOKUP etc)
If you want to change the date of a job you then simply go to the worksheet with the long list and change the date.
Having your data in this long list (ie normalised) format will give you many benefits. For instance you can summerise the report of the data using pivot tables.
If you add filters to the long list (SEE Ribbon>>Data>filters) you can order the data and reduce the list to only show jobs on a selected date, or for a selected team etc...
This is definitely the way forwards. Having restructured the data in this way, you could then add flashy ways to change when a job is taking place by adding buttons on the team worksheets or something.
PART2:
So in you ling list I would recommend excel CONCATENATE function to add an extra column with the text you want displayed elsewhere in your "calendar". #COLUMNA
I would also create another column which is a unique identifier for the row. This will probably be the "Date in YYYMMDD format & timeslot in HHMI format" concatenated together.
In the calendar view sheets say you need a column to display each day of the week with a row for each time slot: You need to
enter a StartDate of the period you want to view
Set up a column for each day (with a formula to calculate the date of the day (ie StartDate, StartDate+1 etc). The date is displayed as a column header (perhaps with a format that shows the dayname, but is stores the date)
each row will have a column that has the timeperiod name and each row will have a value entered. The value is the same as those used in the long list's timeperiod column.
When a user double clicks on a cell you can use the worksheet event
Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
in the VBA code, for this event you need to:
see if the cell double clicked is one you want to respond to
if it is find the date and timeperiod from the corresponding column and row header.
use VBA to activate the long list sheet and probably filter to only show the jobs taking place that day or perhaps that week. Then select (or highlight?) the job that was double clicked.
This is quite easy once you know VBA.
There is a lot to know though I would:
use a named range to define the row with the date and another to define the column with the timeperiod
use a named range to define the cells that will respond to a double click
use range functions in VBA like intersection and the entirerow, entirecolumn range properties to find the date and timeperiod of the double clicked cell.
use the macro record to write the initial code that will do the filter.
adjust the code to be well written and to find the date and timeperiod as required.
Create a sheet for all departments? Or just create one sheet where the dept can be chosen.
You could get clever and allow the user to select two cells in the calendar and provide buttons that do things like:
swap the jobs
If they select many cells then a button to Goto the list and only show jobs that were selected in the calendar.
Perhaps the user could select one job and buttons could move the job back or forwards 1,2,7,14 days.
Note that you can use the long list to record other details of the job like time taken, customer, start time, end time etc...
See about Pivot tables here which might give you some ideas about how you can summarise you data to give info like jobs per day, total value of jobs by day, etc...
Before you tie yourself in knots using Excel, you should always consider using Access.... as with someone who know what they are doing, access will deliver a lot more in a shorter period of time and can do nice things like print one page per job etc etc...
(Do you need a contractor?)
mr#HarveyFrench.co.uk

Have Excel Check Cell format at every Change

I have a VBA code that helps users schedule projects by entering either a date or days until completion for particular tasks and then creates a graph that shows the percent completion of the project.
The VBA code hinges on the formatting of the cell to perform its calculations. Excel does a great job of choosing a number or date correctly the first time a user inputs a value. However if a user was to input a date and then decide to input a number (ex: 7) they would end up with 1/7/1900 as the date, which then makes excel perform the VBA incorrectly.
Is there a way to get Excel to "reconsider" the formatting of the cell each time it is changed? If not is there a way to force it to do so in VBA and choose either number or date formatting only?
Thanks,
-MK
Yes,
as a user prefixing an "=" is probably your best bet.
Adding "e0" on the end will format as an ugly scientific number, but at least it's accurately represented in memory.
Another option is multiplying by 100 followed by a "%".
You've accurately noticed that dates to numbers don't change back as easily. On the other hand any entry with a front-slash '/' seems to format as a date pretty reliably. The single apostrophe ' formats as Text, which is not very good for automated solutions. A number by itself is too general to change the NumberFormat, so any "automatic" solution would be non-standard.

Count colored cells with a VBA function and output number of hits?

I have a simple time schedule sheet that we use to keep track of who is working when. It is simple a set of cells covering 24h, where each cell is representing 15 minutes.
There all kan mark when they have worked during the day by just fillng the cells with "their" color.
We have up to four ppl working every day, and I wan't to have an automatic summary of the number of hour they've worked everyday. Right now I have a separate column for each emplyee and besid every day, where I manually fill in the time, but I would like to have this done automatically whenever day fill in their color.
Is that even possible? Anyone got any hints on this to help me forward?
Thanks in advance,
Hmb
Thanks for the link to the other thread here at stackoverflow, must have missed it when I tried to look for an answer.
I also found a premade library with coloring functions and alot of explanations about how to use (and not) color-functions in Excel.
http://www.cpearson.com/excel/Colors.aspx
After trying it out I got it all working, and now have a sheet that automatically calculate the times for every person from they colored cells! :)
/Hmb

how to multi conditionally sort values using vba

So I'm pulling data from an external source which returns Date strings of the given format: "10/26/2013 9:46:46 AM"
When I sort the data it does not seem to be able to distinguish between AM and PM values so many noonish / 1 AM values are moved towards the bottom. Has anyone dealt with this before / have a solution to make it recognize the AM/PM aspect along with the day and time?
Thanks
It looks like it is sorting this as text. It may depend on how the data is getting pulled through.
If you select one of the cells and press F2 (to edit) then enter to go to the next cell, does this change your data?
In the code that is pulling the data through, you just need to amend it slightly.
Range("D5").value = string
It may change it slightly to maybe 24 hour time depending on your computer settings
I ended up just splitting the date and time using TimeValue() and DateValue() excel functions.I then wrote a macro to do a 3 key sort based on ticker, date, and then time.

Check values are the same within a certain time period

I have two workbooks with identical sheets and I need to test whether the data they are getting (from different sources) is identical or within a certain threshold. This, I am already able to do fine. I create a third workbook which calculates the difference between the two.
However, the issue is that one workbook updates seconds before the second which means that if a cell gets two quick updates my calculations would lag behind.
So what I was thinking is that I make a note of the cell value in workbook 1 (the faster updating workbook) and if at anytime up to x seconds after workbook 2 cell has the same value as noted, they are good.
...but how would I go about this, is VBA even the best tool for this?
Any ideas?
using timestamps and vba - or maybe even conditional formatting and some good formulas - could solve this for sure.
However, without anything to work on, it is quite a big step to present you a solution.
Basically you would just create timestamps (internally as variables, or during the import process in cells) and then compare your values, after your threshold ran out. If the values of your compared cells still match, then it's ok.
However, this is all quite dependant on how you solved your dataimput and comparison.
My basic feeling, after I red your question was: "why wouldn't you just decrease your update rate of your calculation?"
Another idea: just use an indicator cell, switching between 1 and 0 or so, to indicate, if an update already happend - so, if you compare, you compare value+indicator. which is basically using timestamps without time.