У меня есть электронная таблица с индексом 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
(Извините, здесь не удалось правильно выровнять текст.)
вам нужно сохранить порядок, как в столбце А?
@player0 Нет, пока все есть
с помощью нескольких простых запросов вы можете сохранить ровный порядок:
= {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)})}
Вот это да. Это сработало отлично! Еще один вопрос, скажем, я хотел добавить еще один столбец с именем colors
, а colors
должен соответствовать каждому размеру. Например: если у меня есть размеры 1, 2, 3 и цвета красный и синий.
это означает, что моя таблица должна выглядеть примерно так: uniqueID Title Size Color imgSrc UR135 Beaded Short Dress 1 Red https://...1.jpg UR135 2 Red https://...2.jpg UR135 3 Red https://...3.jpg UR135 1 Blue UR135 2 Blue UR135 3 Blue
это зависит от того, как именно это выглядит, но это можно сделать наверняка
Как я могу отсортировать этот список с изображениями по порядку? Например, есть изображения, оканчивающиеся на xxxx_1_1.png и xxxx_1_2.png.
с этой формулой, вы не можете. Я добавил другое решение, которое решает эту проблему.
если вам не нужен порядок, который нужно сохранить, возьмите это:
= {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))}
= {"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"))}
@player0 docs.google.com/spreadsheets/d/…