match/lookup/vlookup date error in google sheet - match

match/lookup/vlookup date error in google sheet
I am trying to use match(B1,B1:B100,1) , if B1-B100 is in date format, it always returns NA or the last one , if B1-B100 is number , it's fine .
2021-11-24
2021-11-23
2021-11-22
2021-11-19

If you want to find B1 in B1:B100, the formula return 1 (assuming that dates are sorted correctly because you use the final parameter = 1)

Related

The difference in strings in Tableau

I am using Tableau Server version 10.4.3
I have a dimension rTime which has string value. the entries in rTime is of like this
May 10, 2019 8:59:56.303 PM UTC
I want to check whether the rTime is today or not. I cannot use DateParse since my server doesn't have this functionality.
I created a calculated field CheckrTime with below content :
STR(LEFT(SPLIT([rTime],':',1),LEN(SPLIT([rTime],':',1))-2))
When I am dragging CheckrTime into workspace area, the output is coming in below format which is what I wanted :
May 10, 2019
When I am checking ISDATE("May 10, 2019") (a normal string), it is outputting TRUE as expected but when I am checking ISDATE(CheckrTime) it is outputting FALSE . Why?
The reason I am checking above thing is I am looking to use DATEDIFF function of tableau in this way:
DATEDIFF('day', DATE(CheckrTime), TODAY()) == 0
NOTE
If someone is wondering ,I have taken care of the level of granularity.
If you have a better solution then the one I am following, please do tell me.
This is working for me. I would expect May 10 <> May 16 (today) and therefore return false. However, when I change your example to today's date it does in fact come back as true.
You could also try this formula for the date LEFT([rTime],FINDNTH([rTime],' ',3)). It is slightly less complicated but will give you the same answer.
Calculated field (date type) depends the locale used which defines date format. Are you able to use Date function?
In Tableau website there is a example using english locale
For string 06May2017
DATE (LEFT([Original Date], 2) + "/" + MID([Original Date],3,3) + "/" + RIGHT([Original Date],4))
Above mentioned highligts / character between digits which is depending on locale

Erlang - invalid/wrong date

How can I validate a date in Erlang?
What happens is that, for example, the date 2018-02-31 is a "valid date" in the sense that I can work with it. When I insert this date on a table (field date) it converts itself to 2018-03-03 (2018-02-28 + 3 days).
What I want is a way to let me know that the original date of my example (2018-02-31) is indeed an invalid date.
Thank you.
Try to use calendar module
calendar:valid_date(Date) -> boolean().
calendar:valid_date(Year, Month, Date) -> boolean().
You will receive true or false
The detailed information and correct input format is here Erlang Calendar Module
I found out that this works just fine for me:
calendar:valid_date()
Thank you.

Google Sheets convert Text String cell into Date + Duration cell

I get a csv file which I import into a google sheet.
I want to calculate the difference between two "Date Time" combination fields, which are now Text fields and not "Date Time" fields.
Before May they were proper "Date Time" fields in DD.MM.YYYY 00:00, which Google Sheets could work with to calculate the difference in the duration for me. "Updated - Created = Difference". Now it's a text field with the wrong format and the auto convert or manual setting doesn't work. And I work here with a few hundred data sets. So via hand it's a bit rough work...
The DATEVALUE function doesn't work for me. And it was the only related thing I could find.
Created Updated Difference
07/May/18 06:54 07/May/18 07:14 #VALUE!
07/May/18 07:19 07/May/18 07:28
07/May/18 07:02 07/May/18 07:56
Example how it should look like (Slash or Dot shouldn't matter):
Created Updated Difference
07.May.18 06:54 07.May.18 07:14 00:20
07.May.18 07:19 07.May.18 07:28 00:09
07.May.18 07:02 07.May.18 07:56 00:54
Error code:
Error
Function MINUS parameter 1 expects number values. But '07/May/18 07:14' is a text and cannot be coerced to a number.
Thanks for your help.
This formula will convert month names into numbers [1-12]:
=REGEXREPLACE(A1;
"[A-Za-z]+";
"" & VLOOKUP(REGEXEXTRACT(A1;"Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec");
{"Jan"\1;"Feb"\2;"Mar"\3;"Apr"\4;"May"\5;"Jun"\6;
"Jul"\7;"Aug"\8;"Sep"\9;"Oct"\10;"Nov"\11;"Dec"\12};2;))*1
A result is a serial number: 43227,2875.
After conversion, you may count duration.
So the problem is actually with the language settings.
When I import the data, I've to set the sheet before to US. Then i can work with it. After that I can switch it back to DE and it automatically converts.

How to select specific date from date picker in UFT 12.05?

I want to select the Date from date picker where data is passing from outside uft i.e xls files,here i'm facing the problem i.e unable to select particular date i.e for example:
25-Aug-1960,in this one i'm able to select Aug and 1960 but unable to select 25 from date picker,please help how to resolve this issue.
Wait(4)
Browser("Customer Managemen").Page("Manage Customer_2").WebEdit("birthDate").Click
Browser("Customer Managemen").Page("Manage Customer_2").WebList("Year").Select "1950"
wait(2)
Browser("Customer Managemen").Page("Manage Customer_2").WebList("Month").Select "Aug"
Browser("Customer Managemen").Page("Manage Customer_2").Link("Dno").Click
Here Dno means -2 in date picker.
take a look at this answer here: Automating Date Control using QTP
Also, use the below code as reference to change it
Browser("Browser").Page("Page").Frame("DatePicker").highlight
Browser("Browser").Page("Page").Frame("DatePicker").WebList("Month").Select "Jan"
Browser("Browser").Page("Page").Frame("DatePicker").WebList("Year").Select "2015"
Set A = Browser("Browser").Page("Page").Frame("DatePicker").Link("1")
A.SetTOProperty "text",11
A.Click

Timezone issues returning a date object to a Google Sheets spreadsheet

I'm writing a custom function to return financial quotes obtained from Yahoo Finance to a Google Sheets spreadsheet (the built-in GoogleFinance() won't cut it for various reasons), and I'm having problems to return a Date object containing the date and time of the quote. https://developers.google.com/apps-script/guides/sheets/functions says that "Times and dates in Sheets become Date objects in Apps Script. If the spreadsheet and the script use different time zones (a rare problem), the custom function will need to compensate", but it's not clear how.
First of all, the timezone of my browser is "asia/hong_kong", i.e. GMT+0800 (HKT). It turns out that the script somehow knows that, because when I format a Date object built with d = new Date(2016,5,24,0,0,0,0) with d.toString() I get "Wed Jun 24 2016 00:00:00 GMT+0800 (HKT)". This is weird, because SpreadsheetApp.getActiveSpreadsheet().getSpreadsheetTimeZone() actually returns "America/Los_Angeles", indicating that the server is on the West Coast of the US: so why does the method toString(), which is run on the server side, format the date according to the Hong Kong time? This sounds like a bug to me.
Anyway, the biggest problem I'm having is that when the custom function returns the date object to the spreadsheet, if I format the cell with Format -> Number -> Date time, what I see displayed is "23/06/2016 09:00:00", i.e. the date and time on the US West Coast when the Hong Kong date and time are the ones I specified through the parameters passed to the constructor (corresponding to Wed Jun 24 2016 00:00:00).
Then I tried to build the Date object with new Date(Date.UTC(2016,5,24,0,0,0,0)), but (predictably enough) now the spreadsheet displays "23/06/2016 17:00:00", which is the date and time on the West Coast when the UTC date and time are the ones I specified.
So, how do I get a Date object that, once returned to the spreadsheet, shows exactly the same date and time I used to build it? I tried to change the spreadsheet's timezone to UTC using ss.setSpreadsheetTimeZone("Etc/UTC"), but then unfortunately the script returns the error "You do not have permission to call setSpreadsheetTimeZone"...
This is the kludgy solution I managed to write (but I hope there is a better way):
// hours and minutes contain values obtained from the text quote; the date is in the string variable:
// date_str = "05/24/2016";
var tz = SpreadsheetApp.getActiveSpreadsheet().getSpreadsheetTimeZone(); // this returns the TZ of the server, "America/Los_Angeles"
var ums = Date.parse(date_str+" UTC");
var offset = Date.parse(Utilities.formatDate(new Date(ums), tz, "MM/dd/yyyy HH:mm:ss") + " UTC") - ums; // time in LA - UTC time in ms
var d = new Date(Date.parse(date_str));
d = new Date(Date.UTC(d.getFullYear(),d.getMonth(),d.getDate(),hours,minutes,d.getSeconds())-offset);
return d;