I have to face some problem about my Googlesheets Data. I want to filter my googlesheets data between two dates and also filter more conditions at the same time in same sheets. Below are given some sample data.
https://docs.google.com/spreadsheets/d/1h5PW52PoMUxXtrqEmfXSCWu_OKXVO8IwUbHqcqSPRzs/edit?usp=share_link
Basically, I want to filter data between two date & two more conditions at a same time in same sheets.
Please help me about this issues.
Thanks
I am trying to hard to solve this issues but I cann't solve this with myself. so if anyone solve this issues then please do this.
I'm very glad for all of you.
Thanks
use:
=IFERROR(QUERY('Raw Data'!A2:I,
"where 1=1 "&
IF(A7="",, " and B >= date '"&TEXT(A7, "e-m-d")&"'")&
IF(B7="",, " and B <= date '"&TEXT(B7, "e-m-d")&"'")&
IF(A10="",," and C contains '"&A10&"'")&
IF(A13="",," and D contains '"&A13&"'"), ), "no data found")
You can try:
=query('Raw Data'!A2:I,"Select * Where B >= date '"&text(A7,"YYYY-MM-DD")&"' AND B<= date '"&text(B7,"YYYY-MM-DD")&"'
AND C contains '"&A10&"' AND D contains '"&A13&"'")
Or, if you want to leave the dates empty:
=query('Raw Data'!A2:I,"Select * Where C contains '"&A10&"' AND D contains '"&A13&"'"&if(A7="",""," AND B >= date
'"&text(A7,"YYYY-MM-DD")&"'"&if(B7="",""," AND B<= date
'"&text(B7,"YYYY-MM-DD")&"'")))
Related
The input is an array [Tuesday, Wednesday] but it is should be stored in one cell only.
Using this input I want to know how many days between two dates.
I found a reference but I don't know how to make it as dynamic because it only accept integer weekday.
https://www.extendoffice.com/excel/formulas/excel-count-day-of-week-between-two-dates.html
SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(start_date&":"&end_date)))=week_day))
Someone knows how to achieve this?
EDITED: input is okay in any format as long as it should inside in one cell only
within sheets you can try:
For count:
=INDEX(LAMBDA(aix,COUNTA(IFNA(FILTER(aix,REGEXMATCH(TO_TEXT(WEEKDAY(aix)),JOIN("|",MATCH(SPLIT(REGEXREPLACE(A5,"\[|\]",""),", "),TEXT(SEQUENCE(7),"DDDD"),0)))))))(SEQUENCE(DATEDIF(A2,B2,"d")+1,1,A2,1)))
For list:
=INDEX(LAMBDA(aix,IFNA(FILTER(aix,REGEXMATCH(TO_TEXT(WEEKDAY(aix)),JOIN("|",MATCH(SPLIT(REGEXREPLACE(A5,"\[|\]",""),", "),TEXT(SEQUENCE(7),"DDDD"),0))))))(SEQUENCE(DATEDIF(A2,B2,"d")+1,1,A2,1)))
use:
=SUMPRODUCT(REGEXMATCH(TEXT(SEQUENCE(DAYS(B2, B1)+1, 1, B1),
"dddd"), REGEXREPLACE(A4, ", ?", "|")))
I have the table in google-sheets which looks:
I need to sum sums according to the Card = "HDFC"
i.e need to display in cell 1408.8
Need help here.
I Tried:
=COUNTIF(C3:C1000,"HDFC")
but its give count only not sure how to use to get sumif on column B if matches column C
Simple SUMIFS() must work. Try-
=SUMIFS(B4:B,C4:C,E4)
or these:
=SUM(FILTER(B:B; C:C="HDFC"))
=INDEX(QUERY(B:C; "select sum(B) where C = 'HDFC'"); 2)
I'm currently using the following formula:
=IFS(regexmatch(A2,"Malaysia"),
B2-dataset!B3,REGEXMATCH(A2,"Saudi Arabia"),
B2-dataset!B7,REGEXMATCH(A2,"Taiwan"),
B2-dataset!B11,REGEXMATCH(A2,"Russia"),
B2-dataset!B15,REGEXMATCH(A2,"Greece"),
B2-dataset!B19,REGEXMATCH(A2,"South Africa"),
B2-dataset!B23,REGEXMATCH(A2,"UAE"),
B2-dataset!B27,REGEXMATCH(A2,"Albania"),
B2-dataset!B31,REGEXMATCH(A2,"India"),
B2-dataset!B35,REGEXMATCH(A2,"South Korea"),
B2-dataset!B39,REGEXMATCH(A2,"Turkey"),
B2-dataset!B43)
The idea is that B2 (currently as =date(dd/mm/yyyy) has a deadline date. C2 (in which the formula houses) should show the date when everything should be delivered.
Currently the outcome is a number, not a date. I've tried IF statement, which delivers a date but I can only add 3 arguments. Can someone help me?
Kind regards
if your current output is number like 40000+ it's ok and it's just formatting issue. either you will format it internally or use a formula.
try:
=TEXT(IFS(regexmatch(A2,"Malaysia"),
B2-dataset!B3,REGEXMATCH(A2,"Saudi Arabia"),
B2-dataset!B7,REGEXMATCH(A2,"Taiwan"),
B2-dataset!B11,REGEXMATCH(A2,"Russia"),
B2-dataset!B15,REGEXMATCH(A2,"Greece"),
B2-dataset!B19,REGEXMATCH(A2,"South Africa"),
B2-dataset!B23,REGEXMATCH(A2,"UAE"),
B2-dataset!B27,REGEXMATCH(A2,"Albania"),
B2-dataset!B31,REGEXMATCH(A2,"India"),
B2-dataset!B35,REGEXMATCH(A2,"South Korea"),
B2-dataset!B39,REGEXMATCH(A2,"Turkey"),
B2-dataset!B43), "dd/mm/yyyy")
I have one sheet with data on my facebook ads. I have another sheet with data on the products in my store. I'm having trouble with some countifs where I'm counting how many times my product ID exists in a row where multiple numbers are. They are formatted like this: /2032/2034/2040/1/
It's easy on the rows where only one product ID exists but some rows have multiple ID's separated by a /. And I need to see if the ID exists as a exact match alone or somewhere between the /'s.
Rows with facebook ads data:
A1: /2032/2034/2040/1/
A2: /1548/84/2154/2001/
A3: /2032/1689/1840/2548/
Row with product data:
B1: 2034
C1: I need a countifs here that checks how many times B1 exists in column A. Lets say I have thousands of rows with different variations of A1 where B1 could standalone. How do I count this? I always need exact matches.
You can compare the number you want (56) with the REGEX #MonkeyZeus commented whith a little change -> "(?:^|/)"&B1&"(?:/|$)" so the end result is:
=IF(REGEXMATCH(A1, "(?:^|/)"&B1&"(?:/|$)"), true, false)
Example:
UPDATE
If you need to count the total of 56 in X rows you can change the "True / False" of the condition for "1 / 0" and then do a =SUM(C1:C5) on the last row:
=IF(REGEXMATCH(A1, "(?:^|/)"&B1&"(?:/|$)"), 1, 0)
UPDATE 2
Thanks for contributing. Unfortunately I'm not able to do it this way
since I have loads of data to do this on. Is there a way to do it with
a countif in a single cell without adding a extra step with "sum"?
In that case you can do:
=COUNTA(FILTER(A:A, REGEXMATCH(A:A, "(?:^|/)"&B2&"(?:/|$)")))
Example:
UPDATE 3
With the following condition you check every single possibility just by adding another COUNTIF:
=COUNTIF(A:A,B1) + COUNTIF(A:A, "*/"&B1) + COUNTIF(A:A, B1&"/*") + COUNTIF(A:A, "*/"&B1&"/*")
Hope this helps!
try:
=COUNTIF(SPLIT(A1, "/"), B1)
UPDATE:
=ARRAYFORMULA(IF(A2<>"", {
SUM(IF((REGEXMATCH(""&DATA!C:C, ""&A2))*(DATA!B:B="carousel"), 1, )),
SUM(IF((REGEXMATCH(""&DATA!C:C, ""&A2))*(DATA!B:B="imagepost"), 1, ))}, ))
I have code that currently looks like this:
replace fname = "JACK" if id==103
replace lname = "MARTIN" if id==103
replace fname = "MICHAEL" if id==104
replace lname = "JOHNSON" if id==104
And it goes on for multiple pages like this, replacing an ID name with a first and last name string. I was wondering if there is a more efficient way to do this en masse, perhaps by using the recode command?
I will echo the other answers that suggest a merge is the best way to do this.
But if you absolutely must code the lines item-wise (again, messy) you can generate a long list ("pages") of replace commands by using MS Excel to "help" you write the code. Here is a picture of your Excel sheet with one example, showing the MS Excel formula:
columns:
A B C D
row: 1 last first id code
2 MARTIN JACK 103 ="replace fname=^"&B2&"^ if id=="&C2
You type that in, make sure it looks like Stata code when the formula calculates (aside from the carets), and copy the formula in column D down to the end of your list. Then copy the whole block of Stata code in column D generated by the formulas into your do-file, and do a find and replace (be careful here if you are using the caret elsewhere for mathematical uses!!) for all ^ to be replaced with ", which will end up generating proper Stata syntax.
(This is truly a brute force way of doing this, and is less dynamic in the case that there are subsequent changes to your generation list. All--apologies in advance for answering a question here advocating use of Excel :) )
You don't explain where the strings you want to add come from, but what is generally the best technique is explained at
http://www.stata.com/support/faqs/data-management/group-characteristics-for-subsets/index.html
Create an associative array of ids vs Fname,Lname
103 => JACK,MARTIN
104 => MICHAEL,JOHNSON
...
Replace
id => hash{id} ( fname & lname )
The efficiency of doing this will be taken care by the programming language used