How to exactly write previous month in google excel - google-sheets

I need date today minus one month formula in google excel.
I've already tried:
'=(EOMONTH(TODAY(),-2))+1
But it doesn't seem to work.

Try it this way:
=EDATE(TODAY(),-1)

=DATE(YEAR(EOMONTH(TODAY(),-1)), MONTH(EOMONTH(TODAY(),-1)), day (TODAY()))
same day of month as today, month before.

Related

Update: How to calculate date and time duration into Days in google shee? (excluding Sunday)

I know it's basic but I'm new to this. I just want to know how can I calculate the days duration of the two dates?
For example, I have my start date and time 11/22/2021 15:20:43 and end date and time 11/23/2021 14:51:29 I want to calculate the total days from start to end date and time.
Also, If start date time column is BLANK, return to count of days including date today.
Thank you
All you need to do is use the following formula: '=(C2-A2)'. This will give you the elapsed time between the two cells and display it as hours. You can take this calculation further by adding dates too. This is useful if you have work shifts that go more than 24 hours or that include two days within a single shift.
Assuming start dates in column A and end dates in column B, you can try
={"Duration in Days"; Arrayformula(if(len(A2:A) * len(B2:B), datedif(A2:A, B2:B, "d"),))}
Change ranges to suit and see if that works?
EXAMPLE
REFERENCES:
DATEDIF
there is a DAYS formula exactly for that purpose:
update:
=INDEX(IFERROR(1/(1/DAYS(
REGEXREPLACE(TO_TEXT(B1:B), "(.|..)[\/\-\.](.|..)[\/\-\.](.+) (.*$)", "$2\/$1\/$3"),
REGEXREPLACE(TO_TEXT(A1:A), "(.|..)[\/\-\.](.|..)[\/\-\.](.+) (.*$)", "$2\/$1\/$3")))))
demo sheet

How can I calculate today's date ONLY if today is less than or equal to the last day of the current month in Google Sheets?

I would like to express the following expression in Google Sheets:
IF today's date is less than or equal to the last day of the current month (in this case October 2021), THEN output today's date, OTHERWISE output the last day of the month (i.e. October 31, 2021)
I've tried a few different ways but nothing seems to work. Below is my latest attempt, but I get an #ERROR.
=IF(TODAY(<=2021,10,31),TODAY(),DATE(2021,10,31))
Thank you in advance for your help.
You need EOMONTH() function. Try below formula-
=IF(TODAY()<=EOMONTH(TODAY(),0),TODAY(),EOMONTH(TODAY(),0))
Just use =TODAY(). if you are interested in current month.
If you need today's date, but not further then the last day of October, use:
=MIN(TODAY(), DATE(2021, 10, 31))

Google Sheets - Conditioning Formatting for Date Expiry

I have a spreadsheet with different dates for different clients where the contract expiry date turns red when it's due to expire in 60 days or overdue. The formula I am using is:
=AND((X:X>0), (X:X<60))
But it seems it's not looking at the year, so for example I have a date of 01/09/2021 which is red as the date has already passed (01/09), but it's showing red when it shouldn't because its 2021.
Any ideas? :) Thanks!!
try:
=(X:X>=1)*(X:X<=TODAY()+60)

Get start date the calendar week

I am using google spreadsheet and have the calendar week and the date.
I want to get for each calendar week the start date of the week.
Find below an example:
Find here my google sheet:
https://docs.google.com/spreadsheets/d/1k-KTzyeVo7tNQOBm42bq0JroF_SugTaLvEGsr5Gt-CA/edit?usp=sharing
Any suggestions how to get the start date of the week?
I appreciate your replies!
Anna, I have set up a new sheet called "Erik Help" and placed the following array formula into cell E5:
=ArrayFormula(IF(E2:2="","",DATE($E$2,1,1)+((E3:3-1)*7)-(WEEKDAY(DATE($E$2,1,1),2)-1)))
Since this is an array formula, it "runs" the entire row. No need to drag across.

Automatically find start and end of the work week in a Google Spreadsheet

My work week goes from Monday to Sunday and I need to find a way to have 2 different cells automatically update based on =today() what the actual date of the start and end of the current work week is.
Is there a formula that can find this?
Similarly:
Is there also a similar method to automate the first and last days of the current month in different cells?
Thank you ahead of time for any assistance
Assuming you're referencing a date in A1...
Start of the work week containing that date (assuming work week starts on Monday):
=A1-WEEKDAY(A1;3)
End of the work week:
=A1-WEEKDAY(A1;3)+6
Start of the month:
=EOMONTH(A1;-1)+1
End of the month:
=EOMONTH(A1;0)
I know this is Microsoft Excel documentation, but this describes the EOMONTH function.

Resources