Как объединить строки с одинаковым индексом с разными значениями в Google Sheets? - PullRequest
0 голосов
/ 07 апреля 2019

У меня есть электронная таблица с индексом 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                                          

(К сожалению, здесь не удалось правильно выровнять текст.)

Ответы [ 3 ]

1 голос
/ 08 апреля 2019

, если вам не нужен заказ на сохранение, возьмите это:

={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))}

0

1 голос
/ 08 апреля 2019

с помощью нескольких простых запросов вы можете сохранить четный порядок:

={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)})}

0

0 голосов
/ 12 апреля 2019
={"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"))}

0

...