Date converted to plain text in google spreadsheet - google-sheets

I use importdata() to grab a legacy file and use it in a spreadsheet.
This file contains date's in the yyyymmdd format (i.e. 20150520)
I wish to filter out dates what contain a certain date, so when I type in a cell "20150520") it work fine, but when I calculate or copy the date from another cell, the filter don't work anymore
=filter(import!A1:E77;import!C1:C77=G31)
G31 ="20150520" works fine
G31 =TODAY() #N/A
G31 =text(TODAY();"yyyymmdd") #N/A
How can I compose cell 31, in a way the filter will work
(sheet 'import' has imported data with dates like 20150520(

Your legacy file may be formatting it as a number, in which case you need to change your G31 to a number as well. Try
=Int(Text(Today(),"yyyymmdd"))

Related

Dynamically referencing different sheets by changing sheet range argument depending on another cell's value

[Goal]
I want to be able to have a cells with formulas (such as COUNTIFS) that can change the referencing sheet range depending on the value in another cell.
[Example sheet]
To demonstrate, I've created the below example simple Spreadsheet where it has 3 different sheets. 2 with raw data (2022 Data, 2023 Data) and another with a table that will use the both sheets' raw data.
https://docs.google.com/spreadsheets/d/1Viz3SUibpaIRu77SLwLxjfcd0ZOVmHPQpu8jTdCL92I/edit?usp=sharing
Cell A2 is for selecting the date (formatted to only show the month) and cell E4 is referencing A2 to get the date/month that was selected. D4 and all month cells adjacent to each references each other to get the incremental months.
Cell range B5:E7 is using the COUNTIFS formula to count how many emails or chats were there for that month. You'll notice that the range argument is referencing as: '2022 Data'!.
What I want to do here is to create a COUNTIFS formula with a range argument that can refer to the corresponding sheet depending on the year of that column. For example for cell B5, the month is Jan 2023, I want it to refer to the 2023 Data sheet instead of 2022 Data sheet in a dynamic way.
Obviously, I could add another COUNTIFS so that it can take 2023 Data sheet's data into consideration, however, I'd have to change the formula every time it's a new year.
Using the QUERY function as an example, I know that you can refer to a cell within the string argument if you use the double quotation and the ampersand symbol (example: "&H1&") to get out of the string. I tried doing something similar (example: '"&B4&" Data'!) but nothing worked.
[Question]
Is there somehow where I could potentially change the cell referring range dynamically depending on the value of another cell?
you can use INDIRECT:
=COUNTIFS(INDIRECT("202"&RIGHT(B4, 1)&" Data!A:A"),B4)

Value imported can't be changed to a number

I'm using the function importhtml() on my Google Sheets :
=IMPORTHTML("https://fbref.com/fr/comps/13/Statistiques-Ligue-1";"table";3)
The data are imported but some data are displayed "01.08" and the value is a date. The other values are ok if they contains big number like 1.93. How it's possible to change that and have only numbers and not displayed that value as a date ?
I try to change the format of the cell but the value became a number like 44455.
This is a screen of what I have
Just with the importHTML without any cell formatting
After I format the cell as brut text
How can I have the value as a number so to display 1.08 and not 01.08 ( for Google SHeets this is a date )
Thanks a lot in advance
Just add a fourth parameter, which stands for locale.
=IMPORTHTML("https://fbref.com/fr/comps/13/Statistiques-Ligue-1";"table";3;"en_US")
This solved the problem here, since it turns the decimal points into commas, not allowing GS to interpret it as date format.

Why does a different result show up when filtering a date in google sheets?

I'm very new to programming so I'm not sure how to phrase this but in google sheets, I'm having a problem:
when filtering results using =IFERROR(FILTER('Segment Management'!B:B,'Segment Management'!A:A=B5)), it works perfectly fine with letters and numbers but when there's a date in Segment Management cell B5 it instead of saying the date (in this case 15/3/2020) it outputs "43906". Could I get some help to explain why it says this number instead of the date?
Date is considered as plain number in google sheets that's the reason you get numbers instead of date you can either do either of one
Select the column where you have put formula & in menu Format> Number> and select date formatting
OR
use this formula =ARRAYFORMULA(TEXT(FILTER('Segment Management'!B:B,'Segment Management'!A:A=B5),"DD/MM/YYYY"))

How to change MM/DD/YYYY to DD/MM/YYYY

I have imported a CSV file to the spreadsheet that includes columns with Dates and timestamp (Columns D,E,K,L) and I'm currently facing 2 problems with these columns.
Some rows are formatted as text/string and I can't seem to change it to date format. I tried manually changing it via format>number>datetime but it remains the same.
the format of the date is being read incorrectly by spreadsheet. For example, 5/11/2018 is being read as May 11, 2019 but if you try to review the spreadsheet, it should be read as November 5, 2018. I tried playing with the format and spreadsheet settings to no avail.
Spreadsheet Sample
I'd appreciate any inputs.
UPDATE
For Column D & E, I have already converted all rows to Date but the problem persists where in some rows are being read as DD/MM/YYYY and some rows MM/DD/YYYY. This creates date discrepancy when I try to make data visualization using these data:(
I am unable to convert all rows in Column L to date format. Some rows are still being read as text/string.
if you have a spare column you can use this formula to correct it:
=DATE(RIGHT(A1; 4); MID(A1; 4; 2); LEFT(A1; 2))
also, you can try to change locale settings in your spreadsheet because it looks like that your spreadsheet uses mm/dd/yyyy format as default. eg. you can try for example Czech locale where default is dd/mm/yyyy
To format custom dates in Google Sheets:
Highlight the column to be formatted.
Navigate the app's menu path:
Format >> Number >> More Formats >> More data and time formats
Put your cursor in the top field of the popup and edit as necessary...
Delete parts you don't want.
Add parts you do want (but make sure you're adding them left-to-right).
Put character(s) between the fields as separators.
Format each part via its dropdown list of options.
Click the "Apply" button, and you're done.

Identify errors between two worksheets

I have two sheets in same workbook. Sheet1 is having the data to be updated and sheet2 is having the data after the update. I want to highlight the errors in Sheet2, with comments beside the cell "E" as Wrong Date Entered. I have tried using VLOOKUP formula but it did not work.
Formula Used: =IFERROR(VLOOKUP(E3,ti,5,FALSE),"Wrong Date Entered")
You could retrieve the date from Sheet1 with a multiple field criteria (using IFERROR to retrieve the new entries) and compare the dates.
      
The formula in SHeet2!F2 is,
=IF(E2=IFERROR(INDEX(Sheet1!$E$2:$E$9,MIN(INDEX(ROW($1:$8)+((Sheet1!$A$2:$A$9<>A2)+(Sheet1!$B$2:$B$9<>B2)+(Sheet1!$C$2:$C$9<>C2)+(Sheet1!$D$2:$D$9<>D2))*1E+99,,))), E2),"", "Wrong Date Entered")
Fill down as necessary. When transcribing for your own purposes, remember that ROW(1:8) is the position within Sheet1!E2:E9, not the actual row on the worksheet.
EDIT:
I opened up the Sheet1 ranges to look at 9999 rows then filtered for the error message and came up with the following.
      
The formula with the larger cell ranges I used was,
=IF(E2=IFERROR(INDEX(Sheet1!$E$2:$E$9999,MIN(INDEX(ROW($1:$9998)+((Sheet1!$A$2:$A$9999<>A2)+(Sheet1!$B$2:$B$9999<>B2)+(Sheet1!$C$2:$C$9999<>C2)+(Sheet1!$D$2:$D$9999<>D2))*1E+99,,))), E2),"", "Wrong Date Entered")
When filling the formula down it did take a few seconds to calculate but I'm only using an older business class laptop so I don't think that the calculation lag was anything completely out of the acceptable range.
You can save both files as pdfs and can compare those files using Acrobat Pro.
Goto View -> Compare Documents..

Resources