Formula to list data in two or more column ranges, excluding blank rows - google-sheets

a
b
c
d
e
f
result
1
q
4
r
q
2
w
5
t
w
3
e
6
e
r
7
r
8
r
t
Column ranges must be used from row 3 to the entire row.
The range referring to the image is B3:B column, D3:D column. Please ignore columns A and C.
The result must not contain blank cells.

Try:
=QUERY(FLATTEN(TRANSPOSE(FILTER(A3:D,MOD(COLUMN(A3:D),2)=0))),"where Col1 is not null")

Related

Workaround Argument must be a range error when using SUMIF + FILTER

Col A
Col B
Col C
a
back
1
a
back
1
b
b
draw
1
c
back
1
c
d
draw
1
d
draw
1
e
draw
1
In Column E I put the values from Column A using UNIQUE and sorting with SORT:
=SORT(UNIQUE(A:A))
In Column F I tried to put a single formula in the first row, to sum each of the total values in Col C according to some filters:
=ARRAYFORMULA(IF(E1:E="","",SUMIF(
FILTER(A1:A,(B1:B<>"draw")*(C1:C<>"")),
E1:E,
FILTER(C1:C,(B1:B<>"draw")*(C1:C<>""))
)))
But I get the error:
Argument must be a range.
Expected Result:
Col E
Col F
a
2
c
1
Is there a way to make the filters become ranges or how should I proceed to avoid this error?
try:
=QUERY(A1:C, "select A,sum(C) where not B matches 'draw|^$' group by A label sum(C)''")

Google Sheet Query: Return All Row Data only in Distinct Columns

I currently have a query returning all data where Particular columns match certain conditions, but I would also like to prevent the return of duplicate data from column1.
A
B
C
D
1
x
y
z
1
x
z
x
2
r
z
w
3
q
y
z
4
q
t
q
4
q
u
r
So far:
=QUERY(A:D, "SELECT * WHERE B = 'x' OR 'q'")
Returns:
A
B
C
D
1
x
y
z
1
x
z
x
3
q
y
z
4
q
t
q
4
q
u
r
How can I also remove the duplciates in column A? So it displays the below:
A
B
C
D
1
x
y
z
3
q
y
z
4
q
t
q
There are many ways to go about this. Given your exact post information, which runs A:D with no headers, here is one way:
=ArrayFormula(UNIQUE(IFERROR(VLOOKUP(FILTER(A:A,ISNUMBER(SEARCH(B:B,"q|x"))),A:D,SEQUENCE(1,COLUMNS(A:D)),FALSE))))
FILTER forms a limited array of only those items in A:A where the corresponding value in B:B exists within the SEARCH criteria string.
VLOOKUP looks up and returns all four columns of values for each of those, which will return the first row of values encountered for every equal value in the FILTERed A:A values. This will result in exact duplicate information for each matching row.
I used SEQUENCE to return an array asking for the return of columns 1,2,3,4 from the requested range. This parameter could have been entered as {1,2,3,4}. But I find SEQUENCE to be more flexible, for instance if in your actual sheet you want the return of 12 columns and not only 4.
UNIQUE eliminates the duplicates.
And, of course, ArrayFormula is necessary because we are processing a range of values.
try:
=ARRAY_CONSTRAIN(SORTN(QUERY({A:D, A:A&B:B},
"where Col2 matches 'x|q'"), 9^9, 2, 5, 1), 9^9, 4)

Check if one cell is contained in a group of cells [Google Sheets]

I have a Google Sheets document that looks like this:
A B C D
1
2 X X 3
3 Z Y 2
4 Z
5
How can I sum the values in column C if their corresponding values in column A are in column B?
In this case, it would be 3 + 2 because both X and Y are in column B.
Many thanks in advance!
Try:
=SUM(FILTER(C2:C,COUNTIF(B2:B,A2:A)))
Docs
SUM
FILTER
COUNTIF

How to get unique values in one column based on unique values in other column

How can I transform this
A P 1
A Q 2
A P 1
B P 1
B Q 2
B R 3
C P 1
C P 1
C Q 2
Into this:
A P 1
A Q 2
B P 1
B Q 2
B R 3
C P 1
C Q 2
More info:
The values in 1st column have common values in Column B which have a relative values in Column C. Column B has multiple of common values for Column A. I want to filter/use other tools to only show unique values in Column B along with Column C which will unique to same value of Column A.
There are also other columns which are different values per entry but I don't care about those.
use simple UNIQUE:
=UNIQUE(A1:C)

calculate difference in counts in 2 columns for corresponding values in other column

I have 4 columns with values (A and C are products that mostly overlap, B and D are counts. What I'd like to do is for the values that occur in both A and C calculate the difference between B and D, and put the result in E and F.
So for example 5028421938592 count is 6 in column B and count is 2 in column D.
The result would be then be in column E: 5028421938592 and column F: 4
5028421928548 3 5028421928548 1
5028421938592 6 3259190205192 7
5028421997131 1 5028421938592 2
5028421995748 4 5028421995748 1
I suggest in E1:
=unique(query({A:B;C:D},"select Col1 where Col1 is not null order by Col1"))
and in F1 and copied down to suit:
=iferror(vlookup(E1,A:B,2,0),0)-iferror(vlookup(E1,C:D,2,0),0)

Resources