Get 3-letter month abbreviation for previous month in Google Sheets - date

I have a spreadsheet with individual tables named DEC19, JAN20, FEB20 etc.
Each of these sheets contains the first and last days in the respective month as dates, so e.g. sheet JAN20 has 1/1/2020 in cell A5.
What I would like is an automatic way to reference the previous sheet via an INDIRECT( prevMonthAsMMMYY(A5) & "!F195" ). Without resorting to macros, how can I achieve this prevMonthAsMMMYY?

try:
=INDIRECT(TEXT("1/"&MONTH(LEFT(A47, 3)&1)-1, "mmm"&RIGHT(A47, 2))&"!F195")

Related

Google Sheets - Protect monthly range script needs monthly triggers at specified date and time

I would like to request help with a script Im trying to put together.
Linked is my test spreadsheet including the script I currently have on the second sheet.
The idea is that this sheet will be copied individually to a group of people. Each person will get their own sheet, editable only by them and myself. It does not get shared any further. Each day the person will add a value into the corresponding day's cell.
On the last day of each month at 8pm, I would like to protect (lock) the cells for that month, to stop the person changing any values that they previously entered.
I have put a repeating script together with a function for each month, covering each range. The problem I'm having is creating triggers that will run the function on the required day. If I set a monthly trigger, they will all trigger at the same time at the end of the first month. Ideally I need individual triggers that will run once a year on the specified date and time for each individual function.
Is this possible? Is there a better way of doing this?
I also realise that I will need to give permissions for each function run, and possibly for each individual copy of the sheet I give to said persons. Is there a clever way around that?
Im also thinking another approach would be for the script to trigger each monthly function 'on open' if the relative date has passed. For example, on Open, if Date is Feb 1st, lock January range, and so on.
Any help provided would be greatly appreciated.
(Note: the true sheet I copied my script and layout from starts this section at Column U, which is why I have minimised Columns A-T).
Test Sheet Link: https://docs.google.com/spreadsheets/d/13z8eWpo6oislkGX3USifLWqh5sz3DsJpSY1YyqNLrx8/edit?usp=sharing

Counting days between 2 dates and swapping one of the dates for another if cell if not empty - google sheets

As the title suggests I'm wondering if there is a way to count days from 1 Column from the current day, then when filling in another column it stops counting the difference in days?
I'm using the following formula (found online)
={"Days";ArrayFormula(if(A3:A="",,int(B3:I)-left(A3:A,10)))}
Column A being where my date of entry is, column B is a hidden column with every row set to the
=Today()
I have another column, Column C that I will enter the date manually after date of completion, at which point I would like it to then stop counting the days and show me the number of days between Column A and C (Date 1 and Date 2)
I'm not overly experienced in google sheets but I'm thinking maybe there's a way to
check if column C is empty, if so carry on with todays date, if it's not empty to
calculate Column C - Column A?
Would making an new column for checking if the completion date has been entered work?
ISBLANK(C:C)
If so would it be possible to get one formula to check whether True or False and determine what 2 dates to work with? Lets say Column D is for ISBLANK the following is what I think of
={"Days";ArrayFormula(if(CD:D="False",,int(C3:C)-left(A3:A,10)))}
={"Days";ArrayFormula(if(D3:D="True",,int(B3:B)-left(A3:A,10)))}
When I try this I have no luck and get a "Result was not expanded automatically, please insert more rows (1)" error message
Any help would be appreciated!
Apply the formula :
=if(B2="",today(),B2)-A2
at C2. And drag downwards. That's should do.
Please share if it work/understandable/not.
Sorry it's a bit hard to understand this question, if you could post a current and desired screenshot example that would help I think.
So, I think your best bet here is to review this video if you're wanting sheets to auto-input a time entry when a cell is modified:
https://www.youtube.com/watch?v=548dD3iXetg
And it will show you how to script a cell to enter in a time entry when another cell is edited, and then you could use a variation of formulas to calculate the difference between the days of the original minus the date from the script (such as the once referenced below or by #p.phidot )
So for an example, once you script the time entry to work in the background of the sheet, you have a formula using an IF statement to make it pull between your today date or the new date being entered.
My cell references below are an example as I can't follow the question sheet.
=if(b2="",A2-B2,A2-C2)
This way if b2 is not blank it'll do a2-c2. You could also use ISBLANK if you like.

How to output Tick Box Grid Responses from Google Forms to Google Sheets as Separate Columns (plus calculates Timezone)?

I need something where our Team Members can select their regular Hours of Availability during the week, in 1 hour intervals, and the results of all Team Members can be seen in a Spreadsheet (and if they fill it out 2 or more times, it will just update their last response). From there, selecting Meeting Times where specific Members can meet should be a lot simpler!
It occurred to me recently that Google Forms and Google Sheets could be one of the best solutions here! But I really don't have much experience with Google Apps Script (which it looks like I'm going to need to do what I want it to do), and so I have some questions:
I have a 7 x 24 (7 Days of the Week by 24 1-Hour Intervals) Tick Box Grid (see linked image here). How can I set it up so it can output each Row+Column in its own separate Column in the output Google Sheet (see linked image here for my preferred output for a single Day)?
In case you're wondering what is going on with the 3rd Row: I have SUM Functions =iferror(counta(L4:L62)) (where L is the Letter of the Column) to Total the "Checked Responses" in each Column for an easy glance of the number of Xs (Yeses) for each Hour Block Column.
How can I customize each Row+Column Checked Response so it outputs as a simple letter X?
I also have a Dropdown Timezone Question, where it asks the User select their Timezone from 1 of the 25 available Timezones in the world. I would like it so their responses to the Hours of Availability Tick Box Grid is modified to match their responses in GMT. So for example, if I select my Timezone as GMT -4, and in the Tick Box Grid I select 12AM to 1AM on Sunday, the Google Sheet will include an X under 7PM to 8PM on Saturday?
Am I asking for too much from Google Forms + Google Sheets API here? And if I am, maybe there is a better Cloud Program I could use for handling this?
So #MattKing (Matthew King) worked closely with me yesterday to get my Tick Box Grid to output to Google Sheets as I intended, as well as handling Timezone Conersion! You can see the Test Results in here:
https://docs.google.com/spreadsheets/d/1g5S5Nyfwr8eHWyn-UXVfdbVj8tdZeY-lU20C2VxuCZ8/edit
I should first mention that the Form Output Sheet (called Form responses) should NOT be modified. Also NO Google API Scripting has been required to get Google Sheets to format the Form Results as I want to. Instead, new Sheets with Formulas (rather complex ones might I add) was the way to go!
To output 1 Hour increments of 24 hours for 7 days: =ARRAYFORMULA(SEQUENCE(1,24*7,0)/24+1)
Each Name in "Form Responses" (in Column A) can be output, in alphabetical order, as follows: =QUERY({'Form responses'!B2:C},"select Col1 where Col2 is not null order by Col1")
Hours of Availability in "Form Responses" (in Columns E through AB) can be output (where each Column is 1 of 24 hours in 1 of 7 days) as follows: =IF($A4="",,IF(ISNUMBER(MATCH($A4&TEXT(B$2,"ddd hh"),UTCData!$A:$A,0)),"X",))
If I want to have separate Meetings in separate Sheets, and I have the Meeting Name (selected as Checkboxes in the Form) in A1, then I can set it up so only the Names of the People who checked that Meeting will be shared as follows: =QUERY({'Form responses'!B2:C},"select Col1 where Col2 Contains'"&A1&"' order by Col1")
He also created for me 2 Sheets that handle more Formula Conversions:
Flattened Form Sheet
Flattened Formula: =ARRAYFORMULA(QUERY(SPLIT(FLATTEN('Form responses'!B2:B&"|"&'Form responses'!C2:C&"|"&'Form responses'!D2:D&"|"&MID('Form responses'!E1:AB1,64,20)&"|"&'Form responses'!E2:AB),"|",0,0),"where Col5<>''"))
Extract Times: =ARRAYFORMULA(IF(D2:D="",,SPLIT(MID(D2:D,2,LEN(D2:D)-2)," to ",0)))
UTC Conversion: =ARRAYFORMULA(IFERROR(MOD(MATCH(SPLIT(E2:E,", ",0),TITLE!C10:I10,0),7)+F2:F+C2:C/24))
UTCData Sheet
Name&UTCDayTimeCombos: =ARRAYFORMULA(QUERY(FLATTEN(IF('Flattened Form'!H2:N="",,'Flattened Form'!A2:A&TEXT('Flattened Form'!H2:N,"ddd hh"))),"where Col1<>''"))
In Column C2 - C8, it lists Sunday through Saturday
If you need someone to help you with your Google Sheets and Forms, I can't recommend Matt's help more!

Highlight a cell if a referenced cell is today's month/day (not year)

I need to use Google Sheets to highlight a student's name if their birthday is today. I have Column A with student's name and a column D with student's birthdate containing the year. I need to highlight the cell that contains their name if it is their birthday today.
I have found Conditional Formatting formulas that show me if it is their birthday month, and those that show me if they were born today, but I do not want to include the year, and I want it to be for only today. I have tried to tinker with these formulas for a couple of hours to make one suit my needs, with no luck.
You can use the following formula to highlight dates that match today's month and day.
IF(AND(MONTH(B1)=MONTH(TODAY()),DAY(B1)=DAY(TODAY())),TRUE,FALSE)
For anyone looking for where to apply this formula for conditional formmating purposes, do the following:
In your sheet, select the column or range of cells you want to format, then go to Format > Conditional formatting, and choose "Custom formula is" from the "Format cells if..." menu to set your formula (then choose the other formatting options you want).

Excel - Insert "day" on a cell and format it to date with current month and year

I am working on a home accounting template (and could not find any good one :-/), so I am creating one for each month. Both in my expenses and my incomes, I would like to have a date column where I just have to insert the "day" (e.g.: 22) and it automatically fills the rest with the current month and year (or I could set them in another cell).
For example: 22 + ENTER would return: 22/12/2014
If I do this, I automatically get a default date: 22/01/1900
I do not know if it is possible to change this defaul date depending on the current one or any other value.
I have tried with a different strategy: if the amount column is not empty, fill in with today's date: =IF(A3="";"";TODAY())
The problem is that I do not always register today's expenses, so I need to change it manually. I was just wondering if this is possible and there is a better way (maybe a macro?).
You need Excel to modify the cell contents after you press ENTER. The only option seems to be a Macro using the Worksheet_Change event.
Please check out this other question. I think that will help.
This can be achieved with simple formatting and use of controls that are available in Excel. VBA will give you drastically more flexibility, however the request above can be accomplished without learning VBA.
I have included a sample file here.
Steps to recreate:
Create a range of months. I created a range including the current month through 12/2014
Insert a combo box from the developer tab. Right click and select Format Control. On the Control tab, input the range you just created and then select a "linked cell". This will insert an integer to indicate which item you picked in the list, starting at 1.
Use the attached formula to add the DAY that you enter in the first column and VLOOKUP the month and year from the value chosen in the combo box.
Enhancements: I used conditional formatting to change the text color of the days you enter to WHITE. This way you won't see them. I also included some checking in the VLOOKUP formula: the day you enter must be a number and must be non-blank for a date to populate.