FILTER and REGEXREPLACE cells with Hyperlinks - google-sheets

I have all the column A with values + Hyperlinks. When I filter these columns, I get only the values of A and miss all the hyperlinks. How Can I keep them?
A B C D
col1 col2 col3 col4
name1 2 3 4
name2 4 6 8
name3 3 5 7
The filter is:
F2 cell:
=ARRAYFORMULA(REGEXREPLACE(REGEXREPLACE(IFERROR(FILTER(A:D, C:C="Seen"), " "), "Day on", "Eng. Pending OT"), "Day off", "Eng. Pending OT"))

REGEXREPLACE will kill the hyperlinks so filter needs to be divided into two parts:
=ARRAYFORMULA({ARRAY_CONSTRAIN(IFERROR(FILTER(A:G, C:C="Seen"), ), 999, 1),
REGEXREPLACE(IFERROR(FILTER(B:G, C:C="Seen"), ), "Day on|Day off", "Eng. Pending OT")})

Related

Google sheets multiple queries, how do I append the sheet name

=sort({QUERY(Kraft!A2:K500, "SELECT A,G,H WHERE G!='' AND J=''", 1); QUERY(Beacon!A2:H500, "SELECT A,B,F WHERE B!='' AND G=''", 1)},3,true)
Comes out like this
Pro Number 1 Trailer 1 Date 1
Pro Number 2 Trailer 2 Date 2
Pro Number 3 Trailer 3 Date 3
Pro Number 4 Trailer 4 Date 4
I would like to append the sheet name, or even simply text (sheet names shouldnt change much, so I can manually update the queries as needed)
Kraft Pro Number 1 Trailer 1 Date 1
Beacon Pro Number 2 Trailer 2 Date 2
Kraft Pro Number 3 Trailer 3 Date 3
Beacon Pro Number 4 Trailer 4 Date 4
Also I should note that there will be about 10 queries in total
Try this
=SORT({
TRANSPOSE(SPLIT(REGEXREPLACE(REPT(","&"Kraft",
COUNTA(QUERY(Kraft!A2:K500, "SELECT A,G,H WHERE G!='' AND J=''", 1))),"^.",""),",")),
QUERY(Kraft!A2:K500, "SELECT A,G,H WHERE G!='' AND J=''", 1);
TRANSPOSE(SPLIT(REGEXREPLACE(REPT(","&"Beacon",
QUERY(Beacon!A2:H500, "SELECT A,B,F WHERE B!='' AND G=''", 1)),"^.",""),",")),
QUERY(Beacon!A2:H500, "SELECT A,B,F WHERE B!='' AND G=''", 1)},4,true)
try:
=SORT({
QUERY(Kraft!A2:K500,
"select 'Kraft', A,G,H where G is not null and J='' label'Kraft'''", 1);
QUERY(Beacon!A2:H500,
"select 'Beacon',A,B,F where B is not null and G='' label'Beacon'''", 1)}, 4, 1)
update:
=SORT({
IFERROR(QUERY(Kraft!A2:K500,
"select 'Kraft', A,G,H where G is not null and J='' label'Kraft'''", 1), {"","","",""});
IFERROR(QUERY(Beacon!A2:H500,
"select 'Beacon',A,B,F where B is not null and G='' label'Beacon'''", 1), {"","","",""})}, 4, 1)

Add cell on different sheet when the adjacent is equal to another cell

I have 2 sheet2 on the same file:
the first collect the answers of different trial judge and the second should make the total
Like this:
First sheet
Name q1 q2 q3 total judge_id
Bob 1 5 8 14 1
Jeff 2 4 2 8 1
Bob 3 1 4 8 2
Bob 5 3 2 10 3
Jeff 6 1 8 15 3
Second sheet
judge_id 1 2 3 tot
Bob 14 8 15 37
Jeff 8 # 15 23
How can I sum only the row on a 'person' in particolar?
There is a fast way to do it without open Google Script?
try:
=ARRAYFORMULA({QUERY({A2:F},
"select Col1,sum(Col5) where Col1 is not null group by Col1
pivot Col6 label Col1'judge_id'"), {"tot"; MMULT(QUERY(QUERY({A2:F},
"select sum(Col5) where Col1 is not null group by Col1 pivot Col6"),
"offset 1", )*1, SEQUENCE(COUNTUNIQUE(F2:F), 1, 1, ))}})
Here's my take on it:
={
QUERY(A1:F,"SELECT A, SUM(E) WHERE A IS NOT NULL GROUP BY A PIVOT F LABEL A 'Judge ID'"),
QUERY(A1:F,"SELECT SUM(E) WHERE A IS NOT NULL GROUP BY A")
}

Condtional formatting to highlight duplicates fetching across multiple columns

I have a sheet where I need to highlight the the second duplicates if they are same across multiple columns.
Sl. No. Name Age Target(Millions)
1 ABC 30 2.3
2 DEF 40 1.3
3 ABC 30 4.3
4 GHI 44 0.3
5 JKL 33 6.3
For example the serial number 3 column Name and Age is to be highlighted because its a duplicate of serial 1 Name and Age
Note that not both rows to be highlighted.
I tried with
=AND(countif($B$2:$C,B2)>1, countif($B$2:$C,C2)>1)
This should do it. I made it scalable for if you want to add more columns:
=ROWS(QUERY(ArrayFormula(TO_TEXT(ARRAY_CONSTRAIN($A:$D, ROW()-1, COUNTA(1:1)))), "select "&JOIN(",", ArrayFormula("Col"&({2,3})))&" where "&JOIN(" and ", ArrayFormula("Col"&({2,3})&"='"&ArrayFormula(HLOOKUP(ArrayFormula(VLOOKUP($A$1,$1:$1,({2,3}),0)),$A:$D,ROW(),0))&"'"))))
Readable:
=ROWS(
QUERY(
ArrayFormula(
TO_TEXT(ARRAY_CONSTRAIN(
$A:$D,
ROW()-1,
COUNTA(1:1)
))
),
"select "&
JOIN(
",",
ArrayFormula("Col"&({2,3}))
)&
" where "&
JOIN(
" and ",
ArrayFormula(
"Col"&
({2,3})&"='"&
ArrayFormula(
HLOOKUP(
ArrayFormula(
VLOOKUP(
$A$1,
$1:$1,
({2,3}),
0
)
),
$A:$D,
ROW(),
0
)
)&
"'"
)
)
)
)
Highlight cell if the number of rows with matching cells in previous rows is >0. To add more columns, you'll have to add to every instance of the {2,3}'s. For example, if you want to include D, add a 4 to the arrays.
If you expect to change which columns you want a lot, you can create a separate column elsewhere with the column indexes that you want, then use FILTER in place of the array to save typing.
This highlights any duplicate cell after the original as well.

I want to populate a new range by inserting numbers between already populated range based on adjusacent cell value

I want to populate a new range and inserting numbers between already populated range based on adjacent cell value.
Eg. if Column A has a range between 1 - 10
and in Column B I entered 3 against the number 4 of Column A
then in Column C a new range should populate splitting 4 into 4a, 4b & 4c as I had entered 3 against it
New list should generate like - 1, 2, 3, 4a, 4b, 4c, 5, 6....
Other examples are entered against no. 7 and 9 of Column A in the image attached.
Screenshot attached below:
try:
=ARRAYFORMULA(QUERY(UNIQUE(REGEXREPLACE(TO_TEXT(UNIQUE(TRANSPOSE(SPLIT(
QUERY(TRANSPOSE(QUERY(TRANSPOSE(A2:A&IFERROR(CHAR(96+SPLIT(IF(B2:B<>"",
REPT("♦1", B2:B), ), "♦")*TRANSPOSE(ROW(INDIRECT("A1:A"&MAX(B2:B))))), ))
,,999^99)),,999^99), " ")))), ".?`$", )), "where Col1 is not null"))
fix for B2 value if 1:
=ARRAYFORMULA(QUERY(UNIQUE(REGEXREPLACE(TO_TEXT(UNIQUE(TRANSPOSE(SPLIT(
QUERY(TRANSPOSE(QUERY(TRANSPOSE(A2:A&IFERROR(CHAR(96+SPLIT(IF(B2:B>1,
REPT("♦1", B2:B), ), "♦")*TRANSPOSE(ROW(INDIRECT("A1:A"&MAX(B2:B))))), ))
,,999^99)),,999^99), " ")))), "\d+`$|`$", )), "where Col1 is not null"))
formula explanation / spreadsheet demo

How to sum all value based on multiple data input in one cell

I have a sheet like this
A B C D
Apple 10 Apple Apple Orange Melon
Orange 30
Melon 50
I want D1 to show the sum value based on the value in C1 which is 2 apples, oranges, and Melon (10+10+30+50) = 100
Any advice on what to type in column D1? I assume it will be related to sumif?
=ARRAYFORMULA(SUMPRODUCT(QUERY({A1:B, IFERROR(VLOOKUP(A1:A,
QUERY(TRANSPOSE(SPLIT(C1, " ")),
"select Col1,count(Col1) group by Col1", 0), 2, 0))},
"select Col2*Col3")))
In addition to the previous formula, this should probably also work:
=sum(ArrayFormula(iferror(vlookup(split(C1, " "), A1:B, 2, 0))))

Resources