Cannot coerce text to number - google-sheets

I'm trying to create a fundraising spreadsheet that will say whether funders are currently open or closed for applications. It should return Open if today's date falls within the funding window; otherwise it should say Closed. Rolling deadlines are always Open.
I would like for it to work regardless of the year, but I'm now getting the following error: "Function MONTH parameter 1 expects number values. But 'rolling' is a text and cannot be coerced to a number." I don't understand why, as it recognizes the cells as non-text. Here's the demo sheet: https://docs.google.com/spreadsheets/d/1GCiQAqsLsEQwgFYXigJPGj6XpZ9UB5uIIejWnmW6V4c/edit?usp=sharing

try:
=INDEX({"Status";
IF(A2:A="",,IF(A2:A="rolling", "Open",
IF(A2:A<=B2:B, IF(
(DATEVALUE(A2:A)<=DATEVALUE(TODAY()))*
(DATEVALUE(B2:B)>=DATEVALUE(TODAY())), "Open", "Closed"),
"end date < start date")))})

Related

Google sheets find from named range a specified date&time display description from that named range

I'm writing a schedule for my wife and I in Google Sheets that seemed to be working but is missing some of our scheduled meetings/appointments. A link to an exact copy is found here.
The idea is that within the "Event Scheduler" I can list in DATE | TIME | DESCRIPTION and it generates a UNIQUE ID using =V14&"|"&COUNTIF(V$14:V14,V14) and also generating a DATE&TIME using DATE&TIME format. I highlight each person (or animal)'s scheduled items in named ranges named "MolliesEvents", "AydensEvents" and "DogsEvents". I now go to the main page, "Daily + Weekly" and compared the current date TODAY() and the time in the E column to the DATE&TIME column of the "Event Scheduler" sheet. Weirdly, this works for some of the scheduled items. However, a significant minority is not captured by the code that I've used. Weirder still, when I compared manually the time in the "Event Scheduler" with the time and date on the "Daily + Weekly" page I get a positive result. However, when I attempt to automate this process it does not.
You are losing events due to rounding.
For example, consider the event "Monday, March 22, 2021 11:30:00 Doctor calling".
In the 'Event Scheduler'!F18 cell is 442770.479166666666667.
In the 'Daily + Weekly'!F14 cell, you use TODAY()&E14 = 442770.479166666666666 in the formula.
Due to the fact that 442770.479166666666667 does not equal 442770.479166666666666, this event does not hit the sheet. This also applies to other lost events.
Possible Solution.
Delete the 'Time Intervals' sheet and enter the time manually on the 'Daily + Weekly' sheet in column E.
Also, I would change the formula like this:
=IFERROR(INDEX(MolliesEvents, MATCH(TODAY()&E14, 'Event Scheduler'!$F$14:$F$1000,0),3),"") (this is in the F14, copy it to other cells).
Here's an example of a spreadsheet that works well.

I need to define a custom work week in MS access

I am trying to create a custom function on a form to define a week Number.
I have created a table that defines the week number.
Example WeekNo, StartDay, End Day
example: WeekNo 1 StartDay = 3/29/2020, End Day 4/4/2020
I have a Date box on my form if I enter a date of 3/29/2020
I would like 1 to be populated in my week number box.
On my form in the row source I have designed a Dlookup query
=DLookup("[WeekNumber]", "tblWeekNumber", "[Startdate] >= " & frmSearchNew.dt_Date & "") & [EndDate] <= frmSearchNew.dtDate
When I change to from view I get the error the record source specified on this form does not exist.
The table tblWeekNumber has the fields ID, WeekNo, StartDay and EndDay.
Where am I going wrong? any help is appreciated.
There are quite a few issues with the DLookup that you have put together.
Firstly, the field that you are looking for and the fields that you are using as criteria do not appear to match those in the table - WeekNumber/WeekNo, StartDate/StartDay, EndDate/EndDay;
Next, the logic for the lookup is wrong. You are trying to find a the week number that has a start date that is greater than the entered date, and an end date that is less than the entered date. What you should be looking for is a start date before the entered date, and an end date after the entered date.
Finally, dates are a bit funny in Access. You need to wrap them in '#' so that Access knows they are dates, and you should also take care to disambiguate them - 03/04/2020 could be either 3rd April or 4th March depending on you nationality.
Putting it all together, the final control source should look like:
=DLookUp("WeekNo","tblWeekNumber","StartDay<=#" & Format([dt_Date],"dd-mmm-yyyy") & "# AND EndDay>=#" & Format([dt_Date],"dd-mmm-yy") & "#")
Regards,

How to create a single date variable from separate month and year variables in SPSS

I have a data set in which the date of an event is represented by two variables: month of the event and the year of the event. I would like to turn these two variables into a single variable, preferably formatted as a date/time variable. How would the syntax for doing this in SPSS look?
NB. I don't have a variable specifying which day (1-31) of the month a date is (and the day isn't important either). I was thinking of either just using a date format that only include the month and year, or specifying that all events happened on the first of each month.
Image illustrating how the variables look:
Image illustrating how the new date variable should look
From the menu:
Transform/Date and Time Wizard/Create a Date/time variables from...
Then select your Month variable to the Month field, Year variable to Year field
Press Next
Put a name into the 'Result Variable` field (e.g.: "MonthYear")
From the "Output format" choose whichever format you want (e.g.: "mmm yyyy")
I would suggest to "Paste" the syntax, in case you need it later ;)
Press Finish and you will get a syntax looking like this (based on the above inputs):
COMPUTE MonthYear=DATE.DMY(1, Month, Year).
VARIABLE LABELS MonthYear "".
VARIABLE LEVEL MonthYear (SCALE).
FORMATS MonthYear (MOYR8).
VARIABLE WIDTH MonthYear(8).
EXECUTE.

TABLEAU: calc field to get the last value available

I'm using Tableau Desktop, my data are like this:
KPI,date,monthValue
coffee break,01/06/2015,10.50
coffee break,01/07/2015,8.30
and I want to build a table like this
KPI, year(date), last value
coffee time, 2015, 8.30
How can I set a calculated field in order to show me the last value available in that year? I tried to do:
LOOKUP([MonthValue], LAST())
But it didn't work and tells me 'cannot mix aggregate and non-aggregate', so I did:
LOOKUP(sum([MonthValue]), LAST())
But it didn't work too. How should I proceed?
If you are using Tableau 9 then you can do this with an LOD calc that looks for the max value in your date field and then checks if the current date value is the same as the max date value.
[Date] == {fixed: max([Date])}
As you can see in the example below when you use the calc as a filter you will only get the last row from your example above.
UPDATE: to get the values per year you can do something like:
Here I am using a table calculation to find the max date per year and then ranking those dates and filtering down to the latest date in each year (which will be the one that has a rank equal to 1).
!max date is WINDOW_MAX(ATTR(Date))
!rank is RANK(Date)
You need to make sure that the table calculations are computer in the correct way (in this case across the values of each year).

evaluate difference between 2 dates to make a transition possible

Is this possible to evaluate the duration between a specified date on a form of a workflow, and the system date ? that what I want to do, in order to show (if this possible too) a short message if 1 day occurs since the specified date above, forbidding the transition of the status Closed to Reopened...
Thanks a lot,
Christophe
I think the Script Runner has a validator that does something like this but I can't find it. Then you could write a post function with the Script Runner. Otherwise it's back to creating a custom validator, as described in my book Practical JIRA Plugins (O'Reilly)
You can use the ScriptRunner plugin in addition with the following script in the validator section for the Reopened transition:
Date now = new Date()
Date cfDate = new Date(cfValues['YourCustomField'].getTime())
new Date(now.getYear(), now.getMonth(), now.getDate()).compareTo(cfDate) <= 0
Replace YourCustomField with the name of your custom field. This will ensure that the transition will check whether the current date is beyond the date set in the custom field, and blocks it if it is.
First of all, thank you for your answer.
It works to allow transition when dates are similar, but my purpose was modified by my responsible. He would like to allow the transition if dates are similar or if the duration between them is only 1 day or less.
Example :
System date is 09/07/2013 (Paris)
My date (dd/mm/yyyy format) Transition allowed Why
07/07/2013 NO my date is former to system date
08/07/2013 NO my date is former to system date
09/07/2013 YES my date and system date equals
10/07/2013 YES only 1 day occur between 2 dates
11/07/2013 NO 2 days occur between 2 dates
Here is the code I wrote in order to do that, but it does'nt work (maybe a Java syntax error?) :
Date now = new Date()
Date cfDate = new Date(cfValues['Date de clôture réelle de la demande'].getTime())
new Boolean(((now.getTime() - cfDate) / 86400000) <= 1) && (now.getTime() >= cfDate ))
Excuse me for my english. I'm french, and I try to improve my English.
Thanks a lot.

Resources