Comments (10)
I can't reproduce your error but maybe try this:
=IF(ISBLANK(E2),"",DATESUBTRACT(text(DATEADD(E2,"Years",3),"MM/dd/yyy"),"Days",1))
Make sure the column/text is formatted to be a date.
Just an idea.
from apps-script-samples.
Still no improvement.
I checked formating and replaced formulas with the one you suggested.
Maybe it is coincidental, but the problem seemed to show up after my list exceeded 20 entries. I currently have 58.
from apps-script-samples.
Here is an example. Although this one functions correctly, even though it is exactly the same data as the original file, minus the personal identifiable information.
https://docs.google.com/spreadsheets/d/1wWbP9QEBNjTUe_fM1b6Gt9_mUJekBl0mkF9IGWCffmo/edit?usp=sharing
from apps-script-samples.
I figured this was for EC (Special Ed) services - I'm a high school administrator.
So even in the example you sent me, it is all loading fine. I was able to reproduce a similar error when I fed in a date formatted as a date value as the first parameter in DATESUBTRACT.
Maybe try this: =IF(ISBLANK(E2),"",DATESUBTRACT(TO_DATE(DATEADD(E2,"Years",3)),"Days",1))
It should ensure that whatever is being fed into the 1st parameter is treated as a date in the format MM/dd/yyy.
from apps-script-samples.
What is the purpose of the script? I'm not terribly familiar with Google Sheets and formulas and it's been awhile since I've messed with Excel formulas beyond simple sums, etc.
If the E column is blank, what is the date subtracted/added from? i.e. what is the DATESUBTRACT(DATEADD(E2,"Years",3),"Days",1)) part of your script supposed to do?
My guess is that there are some cases or inflexibility with this, which is why it is failing sometimes and succeeding other times. I saw your post on Stack Overflow - if you can shed some light on this, I may be able to help, otherwise I would suggest trying to solve the problem in a different way. Usually, it helps me to write out in plain English what I'm trying to accomplish, figure out ways to break it and then once I cannot break it anymore, that's the best solution at the time.
If I know what you are trying to accomplish exactly, I may be able to look and offer a solution or 2 after some research.
from apps-script-samples.
A reevaluation must occur within 3 years of the previous evaluation. /u/jprobst24 is added three years and subtracting a day to make sure his team meets the reevaluation deadline.
If you don't want a Google Script solution, try this: =date(year(E2)+3,month(E2),day(E2)-1).
Also, I like your conditional formatting. This will be a great tool for your team.
from apps-script-samples.
I'm also not able to reproduce this problem. There can be problems when executing a lot of custom functions on the same spreadsheet. One workaround is to use custom functions that operate on ranges of data instead of individual cells. The DATEADD and DATESUBTRACT functions have recently been extended to work on ranges, so you might want to try that.
from apps-script-samples.
Sorry for the delayed responses:
I was still having the same issue with cryingryan's idea:
=IF(ISBLANK(E2),"",DATESUBTRACT(TO_DATE(DATEADD(E2,"Years",3)),"Days",1))
so instead I tried his second idea:
=date(year(E2)+3,month(E2),day(E2)-1).
but changed it to:
=IF(ISBLANK(E2),"",date(year(E2)+3,month(E2),day(E2)-1))
This was weird because originally the DATESUBTRACT method worked fine, and it would work again on a new sheet, but not in the original.
erickoledadevrel, I am curious - how would I use DATEADD and DATESUBTRACT functions to work on ranges? In the past I was building the fomula in F2, and then using copy down to extend it into the rest of the column.
from apps-script-samples.
To make it work on ranges, just pass in a range of values instead of a single cell:
=DATEADD(E2:E100, "Years", 3)
from apps-script-samples.
I'm also not able to reproduce this problem to . There can be problems in the setings.
Long before..
from apps-script-samples.
Related Issues (20)
- Gt
- Completed Tasks are not returned
- no code in solutions/automations/employee-certificate/code.gs
- apps-script-samples/solutions/automations/vacation-calendar/ throws error on events that are part of an event series HOT 1
- Google Mobility Inc
- fly
- How to use FedEx tracking api with sheets
- hi
- test HOT 2
- People
- Incorrect File Name(s) (Missing 's')
- Incorrect File Name(s) (Trailing '2')
- Analytics Data Service - no filter examples
- SENDING AUTOMATIC EMAILS I HAVE TO CLICK ON THREE POINTS WITH THE REFERENCE "SHOW TRIMMED CONTENT" TO SEE ALL THE E MAIL
- Cursor Inspector sample does not work (cursor data doesn't refresh properly) HOT 2
- TypeError: Cannot read properties of undefined (reading 'toLowerCase')
- Bug in sample Calendar code HOT 1
- .clasp.json will be overwrited for people using clasp to upload GAS to their own projects HOT 2
- How to have a Google Workspace Add-on homepageTrigger multiple times?
- could not set the background color the filtered rows. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apps-script-samples.