automatically flagging duplicate times - google-sheets

What I am attempting to do
My workers submit their clock in and out times trough a google form, I have it set up to then automatically add up the duration and show it next to the work ID and name. Up until now its been working perfectly but then I discovered that some accidentally submitted there same shift 2 times. I would like an easy way to flag this overlap. I have attempted to implement this answer but it does not work for AM times. Is there any way I can also detect this for people who work through the night into the morning?
Sheet setup
Current sheet

You have to add one when the finish time is less than the start time:
=if(query(arrayformula({value(F13:F45+G13:G45),value(F13:F45+H13:H45+(H13:H45<G13:G45))}),
"select count(Col1) where
Col1<"&value(H13+F13-1/10^4+(H13<G13))&"
and Col2>"&value(G13+F13+1/10^4)&" label count(Col1) '' ",0)>1,"overlap","ok")
(have changed one row to create an overlap)
If you were just looking for exact duplicates of the shift times, you might have been able to do it more easily with Unique() though.

Related

Google Sheets highlight any duplicate substring in a row

i'm trying to create a smart work schedule for my workplace.
Due to nature of our work sometimes one person has to be responsible for more than one lab. Some splits are possible to manage and some aren't.
I have a ready sheet (called Grafik podzielony) that processes information from another sheet (Grafik).
Work is divided into 3 shifts: 1st one 7:00am-11:00am, 2nd one - 11:00am-2:30pm and the 3rd one from 14:30pm onwards.
I'd like to highlight cells that contain substrings occurring more than once in a particular timeframe (e.g. 7-11am).
I've tried to do this in numerous ways and yet i've failed miserably.
Any help really appreciated.
Here's an editable like to the spreadsheet
https://docs.google.com/spreadsheets/d/17m01Bz7wsq2H0rcIssbVt2Srq2dk477vYjwQXr6ZBOE/edit?usp=sharing
I'd like to highlight cells that contain substrings occurring more than once in a particular timeframe (e.g. 7-11am).
I've tried to do this in numerous ways and yet i've failed miserably.
Any help really appreciated.
Here's an editable like to the spreadsheet
https://docs.google.com/spreadsheets/d/17m01Bz7wsq2H0rcIssbVt2Srq2dk477vYjwQXr6ZBOE/edit?usp=sharing
UPDATE: Try this option that considers each value divided by "/":
=REGEXMATCH(B3;join("|";query(Query(transpose(split(join("/";$B3:$K3);"/";1;1));"Select Col1,count(Col1) group by Col1";0);"select Col1 where Col2>1")))
See at row 3 or row 10:

Trying to COUNTIFS date = this week (sunday-saturday)?

I'm building a spreadsheet that automatically gets a row added when I get an application on my form. Here is the link to the sheet. As you can see, the first tab is just a list of applications, with the location they've applied for, and the date. The second tab is a daily count for each location, which is eventually sent out as an email each night. I'd like to include weekly numbers, and maybe even an ongoing weekly comparison. e.g. # of apps today, this week (so far), last week, etc.
I'm no expert with this stuff and it's getting a bit over my head possibly. Any ideas on how to get this done smoothly?? Thanks a ton in advance!
Your problem (like many) is primarily a problem with the organization of your raw data.
On a new tab called MK.Help, I've put the following formula in cell A2:
=ARRAYFORMULA(QUERY(SPLIT(FLATTEN(Applications!A2:A&"|"&Applications!S2:S&"|"&FLOOR(Applications!S2:S-2,7)+2&"|"&Applications!B2:R),"|",0,0),"where Col4 is not null and Col2>="&I2))
Then I made a simple table on the right with some fairly straightforward COUNTIFS() that look like this:
=COUNTIFS($C:$C,H$2,$D:$D,$F3)
The layout of the data vertically is what's making the formulas relatively simple for the summary.

Adding to a cells value based on two other cells

I'm wondering how I would go about adding to a cell based on two other cells.
For example, I'm creating a Google Sheets document to track profit & loss on certain things in an online game I play.
I'll try to explain this as best as possible.
If cell B71 is equal to the string in cell B7, increase the value in cell D71 equal to the number in cell D7.
However, the values will need to be compared to various other things depending on the item required.
For example, the string in cell B7 might change depending on what specific type of item is needed for that day as it does change daily.
I have cells near the bottom of the sheet which list the different type of item which will show the total amount of items used in that month.
I've tried to explain this a little better as requested below
I'm trying to make a spreadsheet that keeps track of the quantity of a specific item I use in a game for a daily task. This task can be done daily, and to keep track of profit & loss, I have created a spreadsheet to keep track of this.
So, each day, there are three different types of items (runes) that can be used in the machine to create an item called 'Vis Wax'. As Runes are cheap, creating the vis wax can generate a good profit. (I love working with data, hense the spreadsheet.
The image above shows what a daily section looks like. I input each type of rune (has to be 3), input the quantity used and the amount each rune is worth to create the total cost under Total.
Further down below, this table has been created
This will keep track of each rune and the amount used during that month.
So with that said, I'm looking for a solution so that if Air rune is entered in ANY of them slots with the QUANTITY used, it'll update that table accordinly (as well as the other runes that are used too). I've tried nested IF statements, but don't seem to have any luck. With the amount of checks that seem to be happening, I can't seem to find a working solution. As Air Rune might be in slot 1 one day, then slot 3 the next day. So it seems each cell in the Quantity Table will need to compare EACH cell in the daily section, to each rune type that can be used.
Hopefully that has explained it a little better.
Spreadsheet Link
https://docs.google.com/spreadsheets/d/1sYLpZJ46IpNk52gxMoJOIZsOCWToLkC4FF83RBncCf0/edit?usp=sharing
I would suggest you to use a different structure and take all the data from one day in one column, something like this:
In this way you will be able to extend the days keeping the formulas in a really simple way. Below, I will explain some useful formulas that you can use to lighten your work:
Day: =text(DAY(B2),"dddd")
Rune type: Check Data validation to create a drop-down list of your rune types
For counting how many runes have you used you can use SUMIFS function. It returns the sum of a range depending on multiple criteria. In your case, you need apply it three time per rune, as you can have the same rune in three different places. You see it with the following image:
The formula is: =SUMIFS($B$8:$H$8,$B$7:$H$7,A25) + SUMIFS($B$12:$H$12,$B$11:$H$11,A25) + SUMIFS($B$16:$H$16,$B$15:$H$15,A25). In this way you only need to write it once and you can fill the rest of the runes just dragging the mouse. If you need more days just change the column H with the last column that you want to take.
I assume that with all this information you can also keep track of your monthly statics easily. I suggest you to create a different sheet for each month.
I hope that my answer was useful, let me know if you have any doubt.
George, I agree with #fullfine, your data structure does not seem ideal for data analysis. And it doesn't seem that efficient for data entry either, with the sideways scrolling (at least on my screen).
But I recognise that you might not want to change it, perhaps having specific reasons for that layout, and having invested time in it. So I offer this formula as an alternative, which basically pulls the needed cells from your existing sheet, and comes up with the totals you'll need.
=QUERY(QUERY({B7:D9;G7:I9;L7:N9;Q7:S9;V7:X9;AA7:AC9;AF7:AH9;
B20:D22;G20:I22;L20:N22;Q20:S22;V20:X22;AA20:AC22;AF20:AH22;
B33:D35;G33:I35;L33:N35;Q33:S35;V33:X35;AA33:AC35;AF33:AH35;
B46:D48;G46:I48;L46:N48;Q46:S48;V46:X48;AA46:AC48;AF46:AH48;
B59:D61;G59:I61;L59:N61},
"select Col1, Col2, Col3*Col2 where Col1 <>'' order by Col1 label Col3*Col2 '' ",0),
"select Col1, sum(Col2), sum(Col3) group by Col1 label sum(Col2) '', sum(Col3) '' ",0)
The same formula can be used for each month, since it always totals all 31 days, even if the month has fewer days.
For your Rune table in the Statistics sheet, you only need the firsts two columns, so you could delete the "sum(Col3)" from the last select statement.
For your smaller financial table, you would take the sum of the Col3 produced by the above formula, ie. the total value of all the runes used. A similar formula would be used to collect the count of the wax produced, its value, and the profit/loss for each day. This would let you complete the financial table.
If you do decide to go with this approach, and want any help with completing the tables, or the formulas, please share your sheet so "anyone can edit it", to make it easier for me to assist you.

How can I disable automatic recalculation on google sheets?

Simplified scenario:
Sheet Customer_Orders, has blocks of rows with each row having product code, count ordered, and size. Bunch of other stuff is looked up/calculated on the basis of these three tidbits. By the end of the season this sheet has about 5000 rows.
Sheet Raw_Inventory has start of year in the first 500 rows, and then does a query to Customer_orders. By season end this sheet has about 2000 rows.
Near as I can tell, this query runs every time I change one of the 3 fields in Cust_Orders.
Sheet Inv_Status is a pivot table that runs against Raw_Inventory, and again, I think that every time Raw_Inventory is modified, the pivot table is recalculated. (There are a couple of other pivot tables that use the same data.)
The result is that making a change on Cust_Orders can result in up to 2 minutes while the calculations catch up.
(Hardware: Mac Pro, 24 GB ram, 3.2 GHz, 4 core; Current version of Chrome running under Yosemite)
What I would like to do is one of the following:
Lengthen the time between updates.
Be able to recalculate sheet Raw_Inventory manually.
A partial workaround:
I've created a new sheet that imports raw_Inventory. This copy is used for the pivot table. ImportRange only runs every 30 minutes.
The next step will replace the query with 1 zillion simple assignment statements. I'm hoping that this will replace querying 3000 lines with querying a single line when I make a change in Cust_Orders.
There is no way to disable automatic recalculation in Google Sheets. One option is to replace the formulas by the values either by using copy/paste as value only or by using a script. The advantage of using a script is that it also could be used to add again the formulas when needed.
Related
Ho do I stop and start autoupdating in Google Sheets?
Formulas always recalculating when refreshing/loading spreadsheet
I had a similar problem, I solved it by creating an enabling cell and in that cell I put 0 or 1 and then I used that cell inside the formula. In such a way that:
A
B
1
enable formula
0
2
= if(B1=0; 0; complex_formula1)
= if(B1=0; 0; complex_formula2)
3
= if(B1=0; 0; complex_formula1)
= if(B1=0; 0; complex_formula2)
This way when I need to change the spreadsheet I disable formulas (putting 0 on A1), change spreadsheet and on end I enable formulas (putting 1 on A1).
It's not the best solution, but it worked for me.
This is not an answer to my original question -- how to control recalculation, but is a workaround, and ultimately a better solution.
Quick restatement of problem:
CustOrders pulled descriptions of inventory off of RawInv sheet.
RawInv updated from CustOrders. This wasn't quite a circular dependency, as RawInv only updated quantities from CustOrders. But it meant that anytime a change was made in CustOrders, RawInv needed to be recalcuated.
This was made worse by having one query per line creating descriptions.
The solution amounted to refactoring.
Another spreadsheet was created, CustSupport.
It kept RawInv and Trees -- the latter being the descriptions. It also had the master reference sheet for prices and round off tables. These two tabs are rarely changed, and are copied as needed to sheets that use them.
It imported a copy of CustOrders. Since this copy had no dependencies back to to main ordering sheet, I didn't have to wait for it to recalculate.
RawInv recalculated from this copy of CustOrders.
I did a wholesale replacement of Querys with VLookups. This required some rearrangement of columns.

Google Sheets - Vlookup not updating formulas automatically when new sheet reference is created [duplicate]

I have this formula in a cell in a 'Summary' sheet which is waiting for a new sheet to be created with its name being a date:
=IFERROR(VLOOKUP($A3, INDIRECT("'"&TEXT(BN$2,"m/d/yyyy")&"'!$E$6:$o$100"), 11, false), "")
However, when I add the new sheet with the name that would match, then it doesn't automatically recalculate and pull in the values from the new sheet.
The weird thing is if I add a column to the left of this column that has the formula shown above, then it recalculates ... and all is well. Another weird thing is if I add a column far enough away from the column in question then it doesn't recalculate in the same way that it does when I add a column near the column in question (hmmmm....).
What is going on here? And how can I work around it? Seems Google has some major bugs around this area or something ...
This is due to INDIRECT.
A partial workaround:
=IFERROR(INDIRECT("'"&C9&"'!A1"),RAND())
Use this instead of just INDIRECT in your formula. It still won't update on opening and closing. But it'll update, Whenever there's a edit anywhere in the sheet (making this a double volatile combo with RAND()).
Also, Try turning on recalculations every 6 hours or so in spreadsheet settings.
PS: Your Spreadsheet might burn🔥🔥 due to the heavy volatility.
Sorry for the late response, but I believe I have a solution that works a little better. I was experiencing the same problem with formulas involving almost exactly the same set of formulas.
Basically, just add in a check to see if now() equals an impossible time (0), and when it fails (every time), have it execute the formula that won't update on its own.
=IF(NOW()=0,"",
IFERROR(VLOOKUP($A3, INDIRECT("'"&TEXT(BN$2,"m/d/yyyy")&"'!$E$6:$o$100"), 11, false), "")
)
based on idea similar to TheMaster I defined a named range refresh and refered to it in the else portion of the IFERROR formula.
Whenever I create a new sheet, rename an existing one, or feel the need to make sure all indirects are updated I simply edit the content of refresh, and put it back to blank.
=arrayformula(iferror(indirect(B11&"!D42:H42");refresh))
I used Berteh's idea, but found that putting the refresh range within the else portion of the iferror removed the benefit of having a way to have a blank cell if there is no value, or what ever else you'd want to use the else for.
So, to maintain that, I put this together which seems gets us the benefit of preserving the benefit of using iferror and forcing the indirect to update.
=IF(refresh!$A$1=1,IFERROR(VLOOKUP($B68,INDIRECT(D$66&"A1:aa2000"),8,0),""))
Updating the value of the refresh range will force a recalculation (I change the value of cell A1 from 1 to a 0 and then back to 1). I've implemented this on multiple rows across multiple sheets and not found this to blow up the Google Sheet.

Resources