I have 2 columns of names (Name 1, Name 2) which I would like to concat into a single column.
[CURRENT DATA SET] [FORMULA - CONCAT]
| A | B | | D |
| Name1 | Name2 | | Name1_Name2 |
| Name3 | Name4 | | Name3_Name4 |
| Name5 | Name6 | | Name5_Name6 |
This portion is working using my ARRAYFORMULA:
=ARRAYFORMULA(
IF(
ISBLANK(B4:B),
CONCAT(A4:A,B4:B),
CONCAT(A4:A,("_"&B4:B))
)
)
Here is the issue: Sometimes I need the CONCAT formula to put column B first, then Colum A (Example Name2_Name1).
Objective: The CONCAT formula needs to be conditional based on a helper column containing the list of valid name options.
Logic:
If helper column matches CONCAT, CONCAT ColumnA_ColumnB.
If helper column does not match CONCAT, ColumnB_ColumnA.
If still does not match, leave blank.
Expected Results using a helper column
[CURRENT DATA SET] [Helper Column] [EXPECTED RESULTS]
| A | B | | C | | D |
| Name1 | Name2 | | Name1_Name2 | | Name1_Name2 |
| Name3 | Name4 | | Name6_Name5 | | Name3_Name4 |
| Name5 | Name6 | | Name3_Name4 | | Name6_Name5 |
| Name7 | | | Name5 | | |
| Name5 | | | Name8 | | Name5 |
Is it possible to create an arrayformula to achieve these expected results?
Here is my Google Sheet: Click Here
See if this works for you:
=ArrayFormula(IFERROR(IFERROR(VLOOKUP(A4:A&IF(LEN(B4:B), "_"&B4:B,), D4:D, 1, 0), VLOOKUP(IF(LEN(B4:B), B4:B&"_",)&A4:A, D4:D, 1, 0))))
I would like to combine 2 result in one, to make them display in 2 column
what I have:
+------------+------------+------------+------------+------------+------------+------------+
| B | C | D | E | F | G | H |
+------------+------------+------------+------------+------------+------------+------------+
| Supplier A | 40ft | 19-0201 | 02/09/2019 | 05/09/2019 | 05/09/2019 | $2,590.60 |
| Supplier B | 20ft | 19-0206 | 04/09/2019 | 06/09/2019 | 07/09/2019 | $7,198.10 |
| Supplier C | 40ft | 19-0208 | 04/09/2019 | 06/09/2019 | 07/09/2019 | $3,673.40 |
| Supplier B | 20ft | 19-0207 | 04/09/2019 | 07/09/2019 | 08/09/2019 | $5,592.20 |
| Supplier C | 20ft | 19-0203 | 06/09/2019 | 05/09/2019 | 06/09/2019 | $863.30 |
| Supplier B | 20ft | 19-0204 | 05/09/2019 | 05/09/2019 | 06/09/2019 | $4,190.20 |
| Supplier D | 28ft | 19-0205 | 05/09/2019 | 07/09/2019 | 08/09/2019 | $1,390.60 |
| Supplier E | 14ft | 19-0209 | 07/09/2019 | 09/09/2019 | 09/09/2019 | $180.30 |
| Supplier B | 10ft | 19-0211 | 08/09/2019 | 08/09/2019 | 09/09/2019 | $12,392.80 |
| Supplier C | 40ft | 19-0210 | 07/09/2019 | 10/09/2019 | 11/09/2019 | $6,591.30 |
| Supplier B | 20ft | 19-0202 | 03/09/2019 | 12/09/2019 | 13/09/2019 | $1,380.50 |
| Supplier F | 14ft | 19-0213 | 09/09/2019 | 12/09/2019 | 12/09/2019 | $4,576.30 |
this is first query code :
=ARRAYFORMULA(TEXTJOIN(CHAR(10),TRUE,SUBSTITUTE(TRIM(TRANSPOSE(QUERY(TRANSPOSE(QUERY(B16:H34,"SELECT B, D, SUM(H) GROUP BY B, D ORDER BY B ASC LABEL SUM(H)'' FORMAT SUM(H) '$##,##0.00' ")),,COLUMNS(QUERY(B16:H34,"SELECT B, D, SUM(H) GROUP BY B, D ORDER BY B ASC LABEL SUM(H)'' FORMAT SUM(H) '$##,##0.00' ")))))," → "," → ")))&CHAR(10)&CHAR(10)&"Total Costing : "&TEXT(SUM(H16:H34),"$0,000.00")
+-----------------------------------+
| Supplier A 19-0201 $2,590.60 |
| Supplier B 19-0202 $1,380.50 |
| Supplier B 19-0204 $4,190.20 |
| Supplier B 19-0206 $7,198.10 |
| Supplier B 19-0207 $5,592.20 |
| Supplier B 19-0211 $12,392.80 |
| Supplier C 19-0203 $863.30 |
| Supplier C 19-0208 $3,673.40 |
| Supplier C 19-0210 $6,591.30 |
| Supplier D 19-0205 $1,390.60 |
| Supplier E 19-0209 $180.30 |
| Supplier F 19-0213 $4,576.30 |
| |
| Total Costing $50,618.60 |
and my second query code :
={QUERY({B16:H34},"SELECT Col1, SUM(Col7)/"& SUM(H16:H34)&" WHERE Col1 IS NOT NULL GROUP BY Col1 LABEL SUM(Col7)/"& SUM(H16:H34)&"'Scale Of Amount' FORMAT SUM(Col7)/"& SUM(H16:H34)&"'(0.00%)'");"Total Costing Scale","(100%)"}
+---------------+--------------+
| | SUM of Amount|
+---------------+--------------+
| Supplier A | (5.12%) |
| Supplier B | (60.75%) |
| Supplier C | (21.98%) |
| Supplier D | (2.75%) |
| Supplier E | (0.36%) |
| Supplier F | (9.04%) |
| Total Costing | (100.00%) |
How to make it show :
+-------------------------+-------------------------+
| | SUM of Amount |
+-------------------------+-------------------------+
| Supplier A 19-0201 | $2,590.60 (5.12%) |
| Supplier B 19-0202 | $1,380.50 |
| Supplier B 19-0204 | $4,190.20 |
| Supplier B 19-0206 | $7,198.10 |
| Supplier B 19-0207 | $5,592.20 |
| Supplier B 19-0211 | $12,392.80 (60.75%) |
| Supplier C 19-0203 | $863.30 |
| Supplier C 19-0208 | $3,673.40 |
| Supplier C 19-0210 | $6,591.30 (21.98%) |
| Supplier D 19-0205 | $1,390.60 (2.75%) |
| Supplier E 19-0209 | $180.30 (0.36%) |
| Supplier F 19-0213 | $4,576.30 (9.04%) |
| | |
| Total Costing | $50,618.60 (100.00%) |
This the formula that can be used:
=arrayformula({query( sort ( unique({B2:B,D2:D,sumif(B2:B&":"&D2:D,"=" &
B2:B&":"&D2:D,H2:H)}),1,true,2,true),"Select * where Col1 is not null"),
iferror(vlookup(transpose(split(join(",",rept("0,",query(filter(B2:B,B2:B<>""),
"Select Count(Col1) group by Col1 label Count(Col1) ''")-1) &
sequence(counta(unique(B2:B)))),",",true,false)),
{sequence(counta(unique(B2:B))),
query( unique({B2:B,sumif(B2:B,"="&B2:B,H2:H)/sum(H2:H)}),
"Select Col1, Col2 where Col1 is not null")},3,false),"");
{"Total","",sum(filter(H2:H,H2:H<>"")),1}})
Update 1:
= arrayformula
(
{
query (sort (unique({B2:B,D2:D,sumif(B2:B&":"&D2:D,"=" & B2:B&":"&D2:D,H2:H)}),1,true,2,true),"Select * where Col1 is not null"),
iferror (
vlookup(transpose(split(join(",",
rept
(
"0,",query(unique(filter({B2:B,B2:B&":"&D2:D},B2:B<>"")),"Select Count(Col1) group by Col1 label Count(Col1) ''")-1
) & sequence (counta(unique(B2:B)))),",",true,false)),
{
sequence(counta(unique(B2:B))),
query (unique ({B2:B,sumif(B2:B,"="&B2:B,H2:H)/sum(H2:H)}),"Select Col1, Col2 where Col1 is not null")
},3,false
),""
) ; {"Total","",sum(filter(H2:H,H2:H<>"")),1}
}
)
I have 2 spreadsheets and I'm trying to get all the items that the QTY is not equal to zero.
Can someone help me, please?
Example. If the items in Spreadsheet 1 is not 0 it will transfer to Spreadsheet 2 in one cell.
Spreadsheet 1
*---*----*---*----*
| | ITEMS | QTY|
*---*--------*----*
| 1 | BOOK | 4 |
| 2 | PEN | 4 |
| 3 | tape | 0 |
*---*----*--------*
Spreadsheet 2
+---+---------+
| | A |
+---+---------+
| 1 | BOOK 4 |
| | PEN 4 |
+---+---------+
This formula is the formula.
=JOIN(CHAR(10),QUERY(TRANSPOSE(IMPORTRANGE("URL","SUMMARY!B1:C3")),,2000000))
=TEXTJOIN(CHAR(10), 1, TRANSPOSE(QUERY(TRANSPOSE(QUERY(IMPORTRANGE(
"ID", "Sheet1!A:B"),
"where not Col2 = 0 and Col1 is not null", 0)), , 999^99)))
With my countifs formula in column C I want to auto-number (running total) all occurrences of an identical string in column A (e.g. Apple or Orange) but only if on the same row where the string appears column B is of a certain type, e.g. if in column B the type is of "fruit" in column C auto number all occurrences of an identical string in column A. For each new string which is of type "fruit" start the numbering all over again.
The outcome should be like this:
+---+-----------+-------+---+--+
| | A | B | C | |
+---+-----------+-------+---+--+
| 1 | Apple | Fruit | 1 | |
| 2 | Apple | Fruit | 2 | |
| 3 | Mercedes | Car | 0 | |
| 4 | Mercedes | Car | 0 | |
| 5 | Orange | Fruit | 1 | |
| 6 | Orange | Fruit | 2 | |
| 7 | Apple | Fruit | 3 | |
+---+-----------+-------+---+--+
The formula in column C:
=COUNTIFS($A1:$A$1;A1;$B1:$B$1;"Fruit")
=COUNTIFS($A$1:$A2;A2;$B$1:$B2;"Fruit")
=COUNTIFS($A$1:$A3;A3;$A$1:$A3;"Fruit")
…and so on…
I want to translate this formula into an array formula and put this into the header so the formula will automatically expand.
No matter what I've tried it won't work.
Any help is truly appreciated!
Here's a link to a sheet: [https://docs.google.com/spreadsheets/d/1lgbuLbTSnyKkqr33NdVuDEv5eoXFwatX1rgeF9YpIks/edit?usp=sharing][1]
={"ARRAYFORMULA HERE"; ARRAYFORMULA(IF(LEN(B2:B), IF(B2:B="Fruit",
MMULT(N(ROW(B2:B)>=TRANSPOSE(ROW(B2:B))), N(B2:B="Fruit"))-
HLOOKUP(0, MMULT(N(ROW(B2:B)>TRANSPOSE(ROW(B2:B))), N(B2:B="Fruit")),
MATCH(VLOOKUP(ROW(B2:B), IF(N(B2:B<>B1:B), ROW(B2:B), ), 1, 1),
VLOOKUP(ROW(B2:B), IF(N(B2:B<>B1:B), ROW(B2:B), ), 1, 1), 0), 0), 0), ))}
demo spreadsheet
=ARRAYFORMULA(IF(LEN(B2:B), IF(B2:B="Fruit",
MMULT(N(ROW(B2:B)>=TRANSPOSE(ROW(B2:B))), N(B2:B="Fruit")), 0), ))
I want to search a set of data to see if it contains a matching set of values eg.
+------+------+------+------+
| Col1 | Col2 | Col3 | Col4 |
+------+------+------+------+
| A | B | C | D |
+------+------+------+------+
would match the last row in
+------+------+------+------+
| Col1 | Col2 | Col3 | Col4 |
+------+------+------+------+
| B | C | D | A |
| A | D | B | C |
| A | B | B | D |
| D | C | B | A |
| A | B | C | D |
+------+------+------+------+
A boolean return would be fine.
Any pointers would be greatly appreciated.
Cheers
Assumptions
Columns to check: A:D
Values to check are in F1:I1
Result in K1 - boolean
Code
=NOT(ISERROR(
QUERY({ArrayFormula(A1:A&B1:B&C1:C&D1:D)},
"select * where Col1='"&JOIN("",F1:I1)&"'",0)
)
)
Picture