Reputation: 91
I'd like to enter yesterday's date in certain cells in googlesheet, and not have it autoupdate. e.g., TODAY()
and NOW()
autoupdate. I know I can use Ctrl+;
to get today's date, and that remains static. I need the equivalent for yesterday's date.
Googling hasn't turned up anything yet, and neither has the googlesheet docs.
Upvotes: 4
Views: 12821
Reputation: 157
You can use TODAY() and TEXT() formatting to display the date as you want
=TEXT(TODAY()-1, "YYYY-MM-DD")
Upvotes: -1
Reputation: 64032
They this:
function YESTERDAY() {
return new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()-1);
}
Upvotes: 1
Reputation: 38131
Use
TODAY()-1
or NOW()-1
Then copy > paste as values only
The above works because Google Sheets dates are serial numbers where the unit is 1 day.
You could create a macro that does the above which could be called by using a keyboard shortcut. For details about how to create a macro please read https://developers.google.com/apps-script/guides/sheets/macros
Upvotes: 9