I tried different approaches to accomplish what I am looking for and it might not be possible with how I have formated my data but I will try to explain it to see if there is a way.
My origin of data looks like the following:
Case
HELP
100
HELP-01
HELP-02
101
HELP-01
102
103
HELP-03
What I want is to be able to extract the HELP-* into another column without duplicate values and one after another. The result I am looking for is from the above table been able to have this:
HELP
HELP-01
HELP-02
HELP-03
Is there a way to do this in Google Sheets?
Thank you,
Alternatively you can use:
=UNIQUE(QUERY(FLATTEN(B2:C),"where Col1 like 'HELP-%'"))
The QUERY() will now only return those values that start with 'HELP-' in the case you might have other string-values.
A littel more specific even, could be to use:
=UNIQUE(QUERY(FLATTEN(B2:C),"where Col1 matches 'HELP-\d+'"))
Where 'matches' will now use the regular expression to only return values that start with 'HELP-' but end with any 1+ digits.
Try this in Google Sheets
=sort(array_constrain(unique(flatten(B2:C)),counta(B2:C),1))
Related
I'm trying to search 3 different ranges in a tab, and trying to display Yes if all three values (email address, name, x) are found in those ranges. Basically, trying to have the formula confirm that yes, all three of those inputs are somewhere in those ranges (order doesn't matter).
Maybe I should use query or regexmatch or something? Any help is appreciated
Tried this formula:
=IF(AND('Helper Calculations'!$I:$I=$A$1,'Helper Calculations'!$J:$J=L$1,'Helper Calculations'!$L:$L=$A2),"Yes","No")
Was expecting that if the search term in each of those cells ($A$1, L$1, $A2) is found somewhere in the corresponding ranges, then it would say Yes
You can try with this (you can change the use of asterisks by wrapping in AND:
=IF(COUNTIF('Helper Calculations'!$I:$I,$A$1)*COUNTIF('Helper Calculations'!$J:$J,L$1)*COUNTIF('Helper Calculations'!$L:$L=$A2),"YES,"NO")
try:
=INDEX(IF(('Helper Calculations'!I:I=A1)*
('Helper Calculations'!J:J=L1)*
('Helper Calculations'!L:L=A2), "Yes", "No"))
Took a bit more work than I expected, but I got this working. I needed to verify that all 3 values were correct in a single row (must all be correct on that one row, can't find the correct values on multiple rows).
In order to do that, I needed to use array formula, and then decided to use index match and concatenate for the 3 values.
Process described here: https://www.ablebits.com/office-addins-blog/google-sheets-index-match/
correct formula: =IF(ArrayFormula(INDEX('Helper Calculations'!$I:$I,MATCH(CONCATENATE($A$1,L$1,$A2),'Helper Calculations'!$I:$I&'Helper Calculations'!$J:$J&'Helper Calculations'!$L:$L, 0),))=$A$1,"Y"))
In order to clarify the scenario, please check the example here:
https://docs.google.com/spreadsheets/d/1E_xyPvkTIObG5JA4UfG1EQa74cFEc9QiznidJ4HSmEY/edit?usp=sharing
What I want to do here is to:
filter by date (matching a certain date)
filter by product id (matching a list of specified ids)
sum up the total
I did try to find some ideas, though none of them worked, including the solution in the article below
https://exceljet.net/formula/sumifs-with-multiple-criteria-and-or-logic
Really appriciate if someone could point me in the right direction, thanks!
use:
=QUERY({'raw data'!A2:C},
"select Col1,sum(Col3)
where Col2 matches '"&TEXTJOIN("|", 1, 'ids to match'!A2:A)&"'
group by Col1
order by Col1 desc
label sum(Col3)''")
Sumifs is different than Sumif. You also have some text mixed with numbers. Your dates are text while Column b is numeric. Try this:
=Sumifs(C:C:,A:A,"2022-09-08",B:B,82267,B:B,82602) +
Sumifs(C:C:,A:A,"2022-09-08",B:B,82267,B:B,82602B:B,82604)
As Player() points out, if you have too many products to include, using sumifs would get pretty tedious and you ought to consider using a different function (i'd use filter). However since your question was Sumifs related, that's your answer.
To illustrate how this would work with something Filter, you could do this:
=sum(filter('raw data'!C:C,('raw data'!A:A=A2)*
(isnumber(match('raw data'!B:B,'ids to match'!A:A,0)))))
I'd like to run a =SUM(A1:G1), but always skip one column, regardless if it has value or not.
In this case, it should calculate A1+C1+E1+G1.
Is there another function I could append to SUM() or other similar functions as SUM in order to skip one column?
Thank you!
Using the following method you can calculate any number of alternate columns, without the need of manual +
Suppose your data is in second row onwards, use this formula
=SUMPRODUCT(A2:G2, MOD(COLUMN(A2:G2),2))
Simply a sumproduct of cell values and a array of {1,0,1,0,1...}
Another slight variation
=SUMPRODUCT(A2:G2*ISODD(COLUMN(A2:G2)))
But if the even columns contain letters instead of numbers this will give an error, so you can use instead
=SUMPRODUCT(N(+A1:G1)*ISODD(COLUMN(A1:G1)))
Comparing #AnilGoyal's answer, this works as well
=SUMPRODUCT(A1:G1,--ISODD(COLUMN(A1:G1)))
You can use:
=SUM(INDEX(A1:G1,N(IF(1,{1,3,5,7}))))
Or with Excel O365:
=SUM(INDEX(A1:G1,{1,3,5,7}))
A bit more of a general solution:
=SUMPRODUCT(MOD(COLUMN(A1:G1),2)*A1:G1)
Or with Excel O365:
=SUM(MOD(COLUMN(A1:G1),2)*A1:G1)
Or even:
=SUM(INDEX(1:1,SEQUENCE(4,,1,2)))
Since you included Google-Sheets, I'll throw in an option using QUERY():
=SUM(QUERY(TRANSPOSE(1:1),"Select * skipping 2"))
Maybe a bit more verbose, but very understandable IMO.
Consider something of the format:
=SUM(A1:G1)-INDEX(A1:G1,2)
The 2 in the formula means remove the 2nd item in the part of the row. (so the 999 is dropped)
So the formula =SUM(BZ10:ZZ10)-INDEX(BZ10:ZZ10,2) drops CA10 from the sum, etc.(a similar formula can be constructed for columns)
google sheets:
=INDEX(MMULT(N(A1:H3), 1*ISODD(SEQUENCE(COLUMNS(A:H)))))
=INDEX(IF(ISODD(COLUMN(A:H)), TRANSPOSE(MMULT(TRANSPOSE(
IFERROR(A1:H3*ISODD(COLUMN(A:H)), 0)), 1^ROW(A1:A3))), ))
Trying to transpose data such that rows transpose into a single column stacking on top of each other.
=ARRAYFORMULA({TRANSPOSE(A1:C1);TRANSPOSE(A2:C2);TRANSPOSE(A3:C3)})
This formula essentially does what I want but what if I have many more rows? Would I need to enter; TRANSPOSE(Col(x):Col(y)) for every single row?
Any help is appreciated.
Please try:
=TRANSPOSE(SPLIT(TEXTJOIN(",",1,A:C),","))
Notes:
textjoin will join text and skip blanks. Add spaces in column C to have an empty row.
limit of join function is 50000 characters
Max Makhrov's answer is good, but indeed subject to the 50k limit. To get around that, I have recently found another method which is explained in my
interlacing answer to another question
In your case this would look something like this (up to arbitrary 9 rows):
=query(
sort(
{arrayformula({row(A1:A9)*3, A1:A9});
arrayformula({row(B1:B9)*3+1, B1:B9});
arrayformula({row(C1:C9)*3+2, C1:C9})}
),
"select Col2")
Am I missing something, or why does nobody suggest Flatten?
FLATTEN(A1:C3)
And you can use Filter as usual to filter out blank cells, e.g.
=FILTER(FLATTEN(A1:C3);FLATTEN(A1:C3)<>"")
Thanks in advance to all,
I have a spreadsheet with multiple sheets. I want my master sheets to have a search box based on a query that is referencing from a cell( my case A1)
*iv managed to accomplish this, but the search results are only exact match.
can someone help please how can make it a partial match instead of exact or even combined the two.
**iv tried this thread but it doesn't work, maybe I'm doing something wrong
thanks:
Exact result in Google Query, followed by partial match if exact result does not exist
this is the query that is working right now
=QUERY({sheet1!A2:I24;'sheet2'!A2:I26;'sheet3'!A2:I26},"select Col1, Col2, Col4,Col7,Col9 where Col1 = '"&A1&"'",1)
Cheers to all,
From the reference:
like - A text search that supports two wildcards: %, which matches
zero or more characters of any kind, and _ (underscore), which matches
any one character. This is similar to the SQL LIKE operator. Example:
where name like fre% matches 'fre', 'fred', and 'freddy'
where Col1 like '%"&A1&"%'"
Another, more powerful approach is to use filter + regexmatch:
=filter({sheet1!A2:I24;'sheet2'!A2:I26;'sheet3'!A2:I26},
regexmatch({sheet1!A2:A24;'sheet2'!A2:A26;'sheet3'!A2:A26}, A1))
See more on regex syntax here.
The result of a filter may be a query data source:
=query(filter(..., ...), "select Col1, ...")