我有一个电子表格,该电子表格的索引为uniqueStyle
,并有多列。 uniqueStyle
有多个size
和primaryImg-src
。我想折叠它们在自己的单元格中具有相同大小uniqueStyle
和每个img-src的行。
这是我有的例子:
uniqueStyle dressTitle size imageSrc
CH1506 Lace Bodice Sateen Sheath Dress
CH1506 S
CH1506 M
CH1506 L
CH1506 XL
CH1506 2X
CH1506 3X
CH1506 /image/1000x1500/9df78eab33525d08d6e5fb8d27136e95/c/h/ch1506_2_.jpg
CH1506 /image/1000x1500/9df78eab33525d08d6e5fb8d27136e95/c/h/ch1506.jpg
CH1506 /1/image/1000x1500/9df78eab33525d08d6e5fb8d27136e95/c/h/ch1506_3_.jpg
CH1506 /1/image/1000x1500/9df78eab33525d08d6e5fb8d27136e95/c/h/ch1506_4_.jpg
所需的结果输出:
uniqueStyle dressTitle size imageSrc
CH1506 Lace Bodice S.. S /image/1000x1500/9df78eab33525d08d6e5fb8d27136e95/c/h/ch1506_2_.jpg
CH1506 M /image/1000x1500/9df78eab33525d08d6e5fb8d27136e95/c/h/ch1506.jpg
CH1506 L /1/image/1000x1500/9df78eab33525d08d6e5fb8d27136e95/c/h/ch1506_3_.jpg
CH1506 XL /1/image/1000x1500/9df78eab33525d08d6e5fb8d27136e95/c/h/ch1506_4_.jpg
CH1506 2X
CH1506 3X
(抱歉,无法在此处正确对齐文本。)
答案 0 :(得分:1)
通过一些简单的查询,您可以保留偶数顺序:
={Original!A1:F1; ARRAYFORMULA({ARRAY_CONSTRAIN(SORT(IF(ISERROR(VALUE(QUERY({
QUERY(TO_TEXT(Original!A2:D), "order by Col1", 0),
QUERY(TO_TEXT(Original!A2:E), "select Col5 order by Col1,Col5 desc", 0),
QUERY(TO_TEXT(Original!A2:F), "select Col6 order by Col1,Col6 desc", 0)},
"where Col5 is not null or Col6 is not null", 0))), (QUERY({
QUERY(TO_TEXT(Original!A2:D), "order by Col1", 0),
QUERY(TO_TEXT(Original!A2:E), "select Col5 order by Col1,Col5 desc", 0),
QUERY(TO_TEXT(Original!A2:F), "select Col6 order by Col1,Col6 desc", 0)},
"where Col5 is not null or Col6 is not null", 0)), IF(QUERY({
QUERY(TO_TEXT(Original!A2:D), "order by Col1", 0),
QUERY(TO_TEXT(Original!A2:E), "select Col5 order by Col1,Col5 desc", 0),
QUERY(TO_TEXT(Original!A2:F), "select Col6 order by Col1,Col6 desc", 0)},
"where Col5 is not null or Col6 is not null", 0)<>"", VALUE(QUERY({
QUERY(TO_TEXT(Original!A2:D), "order by Col1", 0),
QUERY(TO_TEXT(Original!A2:E), "select Col5 order by Col1,Col5 desc", 0),
QUERY(TO_TEXT(Original!A2:F), "select Col6 order by Col1,Col6 desc", 0)},
"where Col5 is not null or Col6 is not null", 0)), )), 1, 1), 999^99, 4),
QUERY(TO_TEXT(SORT(IF(ISERROR(VALUE(QUERY({
QUERY(TO_TEXT(Original!A2:D), "order by Col1", 0),
QUERY(TO_TEXT(Original!A2:E), "select Col5 order by Col1,Col5 desc", 0),
QUERY(TO_TEXT(Original!A2:F), "select Col6 order by Col1,Col6 desc", 0)},
"where Col5 is not null or Col6 is not null", 0))), (QUERY({
QUERY(TO_TEXT(Original!A2:D), "order by Col1", 0),
QUERY(TO_TEXT(Original!A2:E), "select Col5 order by Col1,Col5 desc", 0),
QUERY(TO_TEXT(Original!A2:F), "select Col6 order by Col1,Col6 desc", 0)},
"where Col5 is not null or Col6 is not null", 0)), IF(QUERY({
QUERY(TO_TEXT(Original!A2:D), "order by Col1", 0),
QUERY(TO_TEXT(Original!A2:E), "select Col5 order by Col1,Col5 desc", 0),
QUERY(TO_TEXT(Original!A2:F), "select Col6 order by Col1,Col6 desc", 0)},
"where Col5 is not null or Col6 is not null", 0)<>"", VALUE(QUERY({
QUERY(TO_TEXT(Original!A2:D), "order by Col1", 0),
QUERY(TO_TEXT(Original!A2:E), "select Col5 order by Col1,Col5 desc", 0),
QUERY(TO_TEXT(Original!A2:F), "select Col6 order by Col1,Col6 desc", 0)},
"where Col5 is not null or Col6 is not null", 0)), )), 1, 1, 5, 1)), "select Col5", 0),
QUERY(SORT(IF(ISERROR(VALUE(QUERY({
QUERY(TO_TEXT(Original!A2:D), "order by Col1", 0),
QUERY(TO_TEXT(Original!A2:E), "select Col5 order by Col1,Col5 desc", 0),
QUERY(TO_TEXT(Original!A2:F), "select Col6 order by Col1,Col6 desc", 0)},
"where Col5 is not null or Col6 is not null", 0))), (QUERY({
QUERY(TO_TEXT(Original!A2:D), "order by Col1", 0),
QUERY(TO_TEXT(Original!A2:E), "select Col5 order by Col1,Col5 desc", 0),
QUERY(TO_TEXT(Original!A2:F), "select Col6 order by Col1,Col6 desc", 0)},
"where Col5 is not null or Col6 is not null", 0)), IF(QUERY({
QUERY(TO_TEXT(Original!A2:D), "order by Col1", 0),
QUERY(TO_TEXT(Original!A2:E), "select Col5 order by Col1,Col5 desc", 0),
QUERY(TO_TEXT(Original!A2:F), "select Col6 order by Col1,Col6 desc", 0)},
"where Col5 is not null or Col6 is not null", 0)<>"", VALUE(QUERY({
QUERY(TO_TEXT(Original!A2:D), "order by Col1", 0),
QUERY(TO_TEXT(Original!A2:E), "select Col5 order by Col1,Col5 desc", 0),
QUERY(TO_TEXT(Original!A2:F), "select Col6 order by Col1,Col6 desc", 0)},
"where Col5 is not null or Col6 is not null", 0)), )), 1, 1), "select Col6", 0)})}
答案 1 :(得分:1)
如果您不需要保留订单,请执行以下操作:
={Original!A1:F1; ARRAYFORMULA(QUERY({
QUERY(TO_TEXT(Original!A2:D), "order by Col1", 0),
QUERY(TO_TEXT(Original!A2:E), "select Col5 order by Col1,Col5 desc", 0),
QUERY(TO_TEXT(Original!A2:F), "select Col6 order by Col1,Col6 desc", 0)},
"where Col5 is not null or Col6 is not null", 0))}
答案 2 :(得分:0)
={"uniqueID", "DressTitle", "dressDescription", "dressTags", "Size", "DressImgs";
ARRAYFORMULA(QUERY(REGEXREPLACE({
QUERY(SORT(IF(LEN(A2:A), {IF(ISERR(VALUE(A2:A)), A2:A, VALUE(A2:A)),
IF(B2:D="", A2:A&"♠", A2:A&"♦"&B2:D)}, ), 1, 1), "select *"),
QUERY(SORT(IF(LEN(A2:A), {IF(ISERR(VALUE(A2:A)), A2:A, VALUE(A2:A)), E2:E,
IF(E2:E="", A2:A&"♠", A2:A&"♦"&E2:E)}, ), 1, 1, 2, 1), "select Col3"),
QUERY(SORT(IF(LEN(A2:A), {IF(ISERR(VALUE(A2:A)), A2:A, VALUE(A2:A)), F2:F,
IF(F2:F="", A2:A&"♠", A2:A&"♦"&F2:F)}, ), 1, 1, 2, 1), "select Col3")},
"(.*)♠|(.*)♦", ""), "where Col5 is not null or Col6 is not null"))}