Using =INDIRECT in google sheets with If statement - google-sheets

So I'm trying to create a Google sheet for a project where every 5 years we need to contact the users , I have set up in the first sheet a column for todays date - another column for date in 5 years then a countdown in the next column (which counts down every day)
I am trying to make it move over to the next sheet once the countdown has say 1 year left on it
I am using indirect =INDIRECT("time keeper!A:E") which is fine it moves over the information however it moves it over instantly - Can I Set it up so once the timer reaches <365 days it moves over to the new sheet and then once I have contacted them I change the date to the current date then make it move back over to the original spreadsheet? or am I expecting too much here of google sheets?
Thanks in Advance!

You can use QUERY to select data based on certain conditions. In this instance you could :
=QUERY(Sheet1! A:D, "Select * Where D =1")
Assuming D is your helper column, if you selected up to E and E was your tick box for contacted you could set it to a true false boolean
=QUERY(Sheet1! A:E, "Select * Where D =1 AND where D = 'FALSE' ")
This would only pull people yet to be coctacted.
You could chain multiple conditions to get a more fluid approach and dynamic approach.
Hope that helps.

Related

How to Auto Fill Date Column (with +30days) form Another Date Column in Google Sheet

I have 2 Columns like this
Where :
Start date is inputed by user
Finish Date is automatically filled with (Start Date + 30 days)
I have used this formula in Finish Date Column
=date(year(A:A),month(A:A),day(A:A)+30)
It works well, But the formula will work if we drag the blue box any number of cells down. I want to make it automatically filled after we input the start date. I also have read that we should use some script but I don't uderstand. Any solution? Thanks!
If you have start dates in A2:A, then array way to obtain the corresponding end date (30 days after) on each row is as follow in B2 cell.
ARRAYFORMULA(if(A2:A="","", A2:A+30))
Note: You can also put the condition like this: if(A2:A="",, A2:A+30) or just:
ARRAYFORMULA(if(LEN(A2:A),A2:A+30,))

How to use TEXT inside a QUERY in Google Sheets

I am trying to create a simple daily time recorded in google sheets. I have created a Google Form named "Time In Records". Each time a user submit a record using that form, it records their name and the time they inputted, as well as the automatic timestamp.
On my other Sheet, which is named "DTR Summary", I am extracting the data from the "Time-In Column" of the "Time In Records" Sheet. I use this code to do that:
=QUERY('TIME IN RECORDS'!$A$2:$E, "select C where E = '"&TEXT($C15,"dd/mm/yyyy")&"' and (B = '"&$A$2&"')")
Basically, I am taking the "Time-In" of a user based on their name(A2) and the date(C15). This works fine, the problem is that I have to manually do this code on the "Time-In Records" Sheet every time a new user submit a data. (The code below is inputted on column E of the "Time-In Records" Sheet) because every time a new data is added, the column E is left blank so I have to manually drag the first cell to the last added data.
=TEXT($A2,"dd/mm/yyyy")
What I would like to happen is to automatically convert the timestamp into a date so that it will match my QUERY. I thought of something like this:
=QUERY('TIME IN RECORDS'!$A$2:$E, "select C where text(A, "dd/mm/yyyy") = '"&TEXT($C15,"dd/mm/yyyy")&"' and (B = '"&$A$2&"')")
Sadly it does not work. I would appreciate any help. Thanks!
For all who are having the same concern, I have figure this out.
On the "Time-In Records" Sheet, I've put this code to column E:
=ArrayFormula(IF(A2:A<>"",TEXT($A2:A,"dd/mm/yyyy"),""))
This automatically converts the timestamp column into date, the current and newly added data.
formula syntax should be:
=QUERY('TIME IN RECORDS'!A2:E,
"select C
where E = date '"&TEXT(C15, "yyyy-mm-dd")&"'
and B = '"&A2&"'")

How can I highlight cells in Google Sheets if current month?

How can I highlight cells in Google Sheets if current month?
The cells have Jan-2017, Feb-2017 etc. and not dates.
I just want the current month highlighted so that the rest of the team can keep track of our monthly stats.
I'm supposing the column that has the months is A, and that the actual values of each cell is the first day of each month (so 2/1/2017 for February for example).
Select where you want the conditional formating to go, and open the conditional formatting sidebar.
Choose "Custom Formula" from the dropdown, and paste the following in:
=$A:$A=(today()-day(today())+1)
What we are doing here is:
=A$:A$ - Look in column A for the following
today() get todays date
-day(today()) get the day and subtract it from the today in the previous point
+1 add 1 to the result because 2/8/2017 - 8 = 2/0/2017, which google sheets actually recognizes as 1/31/2017, so by adding 1 it will become 2/1/2017 which is what is wanted.
The result of this sum is then compared to the data found in A$:A$ and the results which match the sum (today()-day(today())+1) are highlighted.
Just for the record, this may work as well using conditional formatting's custom formula:
=month($A:$A)=month(today())
Considering the dates are in the column A

How to automatically fill data in an invoice in Google Sheets

I am sharing this sheet with you so that you can have a look and give me a proper solution. Basically what I want to do it generate an invoice based on the data entered in "Purchases" but I don't know how to do it as the lot numbers aren't always in the proper sequence. Therefore, if you notice in the "Sale & Inventory" sheet, I have to create multiple entries for one invoice. Is there a simpler method where the invoices are generated automatically? I don't want more than 30 lots/invoice.
Thanks,
Huzaifa.
I can't leave a comment to ask a question, so I assumed you'd want all lots from a certain date. Please see the 'Invoice' tab from this spreadsheet (I duplicated yours). Changing the yellow drop-downs should fill the invoice for you. You can also create multiple pages so it stays A4 size.
I also had to make sure column C on the 'Purchases' tab was formatted as a date 'yyyy-mm-dd' by using the 'Format' menu.
I did this by adding =QUERY(Purchases!$A$2:$T$500,"Select B where B<>'' and C >= date '"&TEXT(REGEXEXTRACT(K3,"[0-9]{6}"),"20##-##-##")&"' and C <= date '"&TEXT(REGEXEXTRACT(L3,"[0-9]{6}"),"20##-##-##")&"' limit 30 offset "&IF(M6=1,0,(M6-1)*34)&"",0) to cell H8 (highlighted green) in 'Invoices' tab.
How it works:
=QUERY(
Purchases!$A$2:$T$500, //the data I want to query
"Select B //tells it which column i want data from
where B<>'' //make sure column B is not blank
and C >= date '"&TEXT(REGEXEXTRACT(K3,"[0-9]{6}"),"20##-##-##")&"'
//makes sure the date is greater than or equal to
//the start date found in your lot code and formats
//it as 'yyyy-mm-dd' which is necessary for the
//query function
and C <= date '"&TEXT(REGEXEXTRACT(L3,"[0-9]{6}"),"20##-##-##")&"'
//makes sure the date is less than or equal to
//the start date found in your lot code and formats
//it as 'yyyy-mm-dd' which is necessary for the
//query function
limit 30 //restricts the returned results to 30 so it does
//not exceed the number of lines on your invoice
offset "&IF(M6=1,0,(M6-1)*30)&" //this shows the 'page' of data that you select
")
Let me know if you have different criteria for invoices and I can help, but try and see if you can figure it out from here first.

How do I import data from another sheet and then filter it based on 2 different variables?

I have been working on how I budget and keep track of my finances. In the process, I put together this Google Sheet which I am happy to share a dummy version of (includes dummy data).
I use a Google Form to input new entries which are recorded in the 'Log' page.
From here, I use a few SUMIFS to pull in the totals of any given income/expense category based on the category name (referenced in the cell adjacent), the month (B3), and the year (C3).
What I now want to do is add a table (currently in columns O:Q) that calls in itemised log records based on the category selected (O2) and the month and the year. On the reference sheet these are cells (B3) and (C3) respectively and in the log, these are columns (F) and (G).
I've gotten as far as using an INDEX / SMALL array formula combination to pull in all spending as per the category selected in (O2), but what I cannot seem to figure out is how to then restrict results to only those that also match the month and year. I've tried using a MATCH formula but am unsure how to append this within the current formula string, if it is even possible?
Once working, this would (for example) mean that only rows 4 and 5 in columns O, P, and Q would be populated as these are the records for the selected month, June 2016.
Is what I want to do possible through a more complex formula? Can anybody help?
Thank you in advance.
Link to my Google Sheet: https://docs.google.com/spreadsheets/d/1_GGgFCfMtB5ROkTmpx4Fn4nZZbBIvBa4vpOwqswH5E0/edit?usp=sharing
The following should do the trick.
Delete everything in O4:Q14
In cell O4, write: =FILTER(Log!H2:H, Log!B2:B=O$2, Log!G2:G=C$3, Log!F2:F=B$3)
In cell P4, write: =FILTER(Log!E2:E, Log!B2:B=O$2, Log!G2:G=C$3, Log!F2:F=B$3)
In cell Q4, write: =FILTER(Log!D2:D, Log!B2:B=O$2, Log!G2:G=C$3, Log!F2:F=B$3)
(By the way, you can generate columns F, G and maybe E from column A in the Logs sheet. For example, just remove the data that is already in column G and in G2 write: =ARRAYFORMULA(YEAR(A2:A))
Link to spreadsheet with fixes:
https://docs.google.com/spreadsheets/d/1iIplXRa28L7FdmqI91RbjApO3g-GU5uk6rTQLqi7vFw/edit#gid=0

Resources