I'm trying to set up a structure in a sheet that allows for a date value to be incrementally (monthly) increased from a given start date. However, I also want each month to be repeated x times before it moves on to the next month, which should then also be repeated x times before moving on, and so on, until a given end date.
I've created this sheet to exemplify my desired output.
In the Example tab, I have a list of names (Sales reps) which, in this case, correspond to the "x" I mentioned previously. This means that I would like each date value to be repeated the same number of times as there are sales reps, before moving on to the next month and repeating it again the same number of times as there are sales reps. This also means that, if I increase the number of sales reps at some point, that should also be reflected in the number of times that a month is repeated. Also, the start and end dates should match the values in D3 and D5.
In columns D and E in the Example tab, I just wrote the kind of behaviour I'm looking for in static values. Can anyone help me fill in the Desired solution tab with a formula that automatically achieves that? That would be much appreciated 🙏🏻😃
EDIT: THINGS TRIED SO FAR
I created a new tab called Undesired solution where I show a hacky workaround that I tried, but that I would like to keep away from. The main reason for that is that, if the number of sales rep was to change:
I would have to manually update the first few cells of column F
I would have to manually update the formula used from G5 onwards
Here's how it looks filled with an array formula. I'm using counta() to get the number of names and month() to get the difference between start and end date in months, then applying sequence with int and mod to get the index of the required date and name, finally applying edate and vlookup to get the actual date and name.
=ArrayFormula({edate(D3,int(sequence(COUNTA(B3:B)*(month(D5)-month(D3)+1),1,0)/COUNTA(B3:B))),
vlookup(mod(sequence(COUNTA(B3:B)*(month(D5)-month(D3)+1),1,0),COUNTA(B3:B)),{sequence(rows(B3:B),1,0),B3:B},2)})
Related
So I'm creating a Google Sheets doc that contains my hours and overtime for an hourly position I have, and how much overtime I'll need to make the amount of money I need to make to survive.
In addition to this I am also trying to track my hours so I can track the actual amount of money I'm making.
So I have a projected clock out time in Column B that uses a formula to tell me what time I need to ideally clock out at based on how many hours I need and what time I clocked in at. When I clock out, I enter the actual time I clocked out at.
In Column C I have the total amount of hours I worked that day, formatted in duration based on the difference between the value in Column A and Column B. If I haven't entered in a value in Column B, it shows me the ideal amount of hours I need that day.
I want to calculate my actual hours worked per week as I'm working that week, so I need to ONLY sum the values in Column C if the adjacent value in Column B is NOT a formula. So I need it to sum the values in column C if I've entered the actual time that I clocked out at in column B.
I've looked up this question and tried multiple solutions I've found here, even tried troubleshooting with ChatGPT, but most are just trying to sum the range that contains the values/formula, and not summing a different column based on if another column has formulas or not.
There seems to be a lot of posts that come super close but don't seem to work for how I need this to work.
Edit: Here is the example sheet.
So F3:F6 are values that have been manually entered, while F:7 has been calculated by a formula.
I need H9 to sum the values of H3:H7, but only the values adjacent to the times in the F column that have been manually entered. In this example, I need it to sum H3:H6 and ignore H7 until I enter a time and remove the formula in F7.
try:
=SUMPRODUCT(MAP(F3:F7,LAMBDA(z,IFNA(FORMULATEXT(z),1))),H3:H7)
You may filter and check if there is a formula with FORMULATEXT. If there isn't it will throw a #N/A error. Then with ISNA it will keep the values in which its adjacents did'nt have a formula:
=SUM(FILTER(C:C,BYROW(B:B,LAMBDA(b,ISNA(FORMULATEXT(o))))))
Collections Sheet
Expenses Sheet
Hi, I would like to get the daily sum/difference of the expenses from the expenses sheet then output to collections sheet using dates as reference/identifier.
I tried this code =MINUS(C8,INDEX(Expenses!20:31,12,2)) but I want it to auto compute when I drag the box. sorry for bad english. thank you
Desired output:
Desired Output
Output at (Net) Cash On Hand Row / Reference Date Column, the output should be August 1 Collection - August 1 Expenses.
The main issue is with the structure of your expense sheet, since you need to use only every second column. For this you can use various methods, something like
=split(substitute(join(";",Expenses!A2:DJ2),"Total:;",""),";")
The join function takes the whole row and joins it into one string, the substitute function removes the Total: from it, along with the trailing ; and the split function separates it again to separate values. This will be an array, automatically spread out to 31(-ish) columns width if entered into a cell like C10 on your Collections sheet.
Then you have two options, simply do =C8-C10 in C9, which you can drag with no problem. You can also hide the row 10 by making the text color white, or even integrate it in that sheet.
My recommendation however is not to do any of that, instead enter the formula
=arrayformula(C8:AG8 - split(substitute(join(";",Expenses!A2:DJ2),"Total:;",""),";")
into C9 on the Collections sheet and it's taken care of, without the need to drag it out. You might need to tweak it, not sure if the AG8 and DJ2 are the correct columns to end them on (should be the last column if every column or every 2 columns is a day). The arrayformula makes sure that the subtractions are done automatically for each pair of values, and expanded automatically into the row. Make sure that there are no values or formulas in D9:AG9, so it can fill up the values automatically and you don't get a #REF error.
The Issue
In simple terms, I am trying to set a formula for an alternating pattern. The issue I keep running into is the fact that there are two alternating values, and Google Sheets doesn't like to repeat only one of those values without the other.
I have created an example sheet to demonstrate my issue. In Column A, a date is input. Column B and Column C then autofill with the day of the week and AM or PM respectively. Every other value in Column C alternates between AM and PM. I am trying to set it up so that the row is blank until a value in input in Column A. The issue comes when there is an odd number of Dates in Column A. Note that the alternating AM/PM pattern will never change.
What I've Tried
As seen in the image above, there are three main methods that I have tried. The data in C2:C8 is the desired result.
Method 1:
E2: =transpose(split({rept(join(";",{"AM";" "})&";",(roundup(counta(A2:A9)/2)))},";"))
F3: =transpose(split({rept(join(";",{"PM";" "})&";",(counta(A2:A9)/2))},";"))
These formulas work separately, and best represent what I am trying to accomplish, but I have not found a way to combine them to work together in one column.
Method 2:
H2: =transpose(split({rept(join(";",{"AM";"PM"})&";",(roundup(counta(A2:A9)/2)))},";"))
This is essentially the same as Method 1, but put into one formula. The issue here is that Google Sheets doesn't like to repeat half a number of times. So if the number of times to repeat (counta(A2:A9)/2) contains a half (i.e. 3.5), it will still round down to the nearest whole number.
Method 3:
J2: =ArrayFormula(TEXT(SEQUENCE(3),"")&{"AM";"PM"})
This one appeared most promising to me because when incrementing by one, it added one row, but I quickly ran into the issue where if I went over a sequence number of 2, it threw the error Array arguments to CONCAT are of different size.
References
I have used various search terms and websites to try to solve this, and have yet to find something that works. I may be missing something very simple, though, and hopefully this is a quick solution.
Example Sheet:
https://docs.google.com/spreadsheets/d/1I3EtptFLfDHpAQ8AR6Lwa01dSpJ3Cy8MTX1_OjHExSc/edit?usp=sharing
All my formulas are derived from the websites below:
REPT Function in Google Sheets
How to Repeat Multiple Columns N Times in Google Sheets
Delete everything in Col C (including the header) and place this formula in C1:
=ArrayFormula({"AM/PM"; IF(A2:A="",,IF(COUNTIFS(A2:A,A2:A,ROW(A2:A),"<="&ROW(A2:A))=1,"AM","PM"))})
The COUNTIFS finds the number of matches for the date "up to this row" for every row. Since that count will (or should) only ever be a 1 or a 2, the IF makes easy work of assigning "AM" or "PM" accordingly.
If I understand correctly it is enough to use ISEVEN function to alternate by rows:
=ArrayFormula(IF(A2:A,CHOOSE(ISEVEN(ROW(A2:A))+1,"PM","AM"),))
I have a sheet used to calculate worked time. The aim is to sum up the hours and divide them in "regular" ones (up to 8h per day) and "overtime" ones (anything more than 8h per day). Each date has to have two rows(the second one is hidden by default), as there are multiple places I can work at, but the time calculated should be summed. Also, time worked on Saturday and Sunday should always be counted as overtime.
Screencap here.
The problem I have is with calculating overtime hours.
Regular hours are generated by:
=arrayformula(IFS(
WEEKDAY(A3:A70; 1)=1;0;
WEEKDAY(A3:A70; 1)=7;0;
E3:E70+E4:E70>8;8;
E3:E70+E4:E70<=8; E3:E70+E4:E70))
They are summed by =SUM(IFERROR(G3:G71;0)), which works just fine. Overtime hours are generated by:
=arrayformula(IFS(
WEEKDAY(A3:A70; 1)=1;E3:E70+E4:E70;
WEEKDAY(A3:A70; 1)=7;E3:E70+E4:E70;
E3:E70+E4:E70>8;E3:E70+E4:E70-8;
E3:E70+E4:E70<=8; 0))
And summed similarly by =SUM(IFERROR(H3:H71;0)) in H72. However, it returns a wrong value - in the sample sheet, it is 57 instead of 7
If I select the summed range, the tooltip shows the correct sum (7). If I add/remove the decimal place or change the formatting in H72, it suddenly changes to the correct one, too. However, when any new data is added (i.e. hours form a new day), it goes back to showing incorrect values.
It is not a simple display error, because the values are then imported by another sheet via =IMPORTRANGE and it imports those wrong values.
Any idea how to fix it?
Sample sheet here
try in H72:
=INDEX(SUM(IFERROR(1*H3:H71;0)))
update:
=INDEX(SUM(IFERROR(FILTER(1*H3:H71; MOD(ROW(H3:H71)-1; 2)=0); 0)))
I work for a small business that depends quite a lot on the weather. I’m trying to create a spreadsheet (in google sheets) to predict daily revenue. At the moment the spreadsheet simply multiplies last year’s corresponding day by the growth percentage to get this year’s daily values. I’m trying to include the weather forecast (15 days) in the calculation. I’ve managed to import the forecast successfully using an api tutorial that I found online (https://www.visualcrossing.com/weather-data), and include the forecast values in the revenue calculation.
Now for the issue:
*the revenue prediction is a spreadsheet with every row being a day of the year, making the spreadsheet 365 rows long
*the imported forecast (in another tab, not sure that’s relevant) is only 15 rows long and updates every day, meaning that it remains that length. No new row is added during the update: the data just shift one row up and the first day disappears while a new day takes the bottom row.
My formula in the revenue tab identifies the weather data in the weather tab by row but when I pull the formula down for the whole year (down 365 rows, that is), only the first 15 rows refer to existing data in the weather tab. -> Not only are the results obtained based on the wrong row as soon as the weather tab updates on day 2, but they are also referring to totally empty cells from day 16 on.
So my questions are:
*is there a way to force the daily weather forecast to remain on its row and add a new row every day, or failing that,
*is there a way for the formula to recognize the matching day cells and use the value of the cell x columns to the right of it, effectively skipping the row referencing altogether
I’ve added a very simplified sketch of the spreadsheets for the more visual helpers out here
Apologies if this is unclear, I do not have a tech background but am happy to clarify anything if needed.
-- Edit: Here is a screenshot of the revenue tab. The expected output is in column K. The values in it at the moment are incorrect.
Seems like you just need a dynamic way to match the dates? I can't tell if you meant to have prior year data in other tab, but this spreadsheet matches your example and returns the value irrespective of the row order.
The formula being used (in the top row) is:
=B1*index(WeatherTab!B:B,match(A1,WeatherTab!A:A,))*index(WeatherTab!C:C,match(A1,WeatherTab!A:A,))