根据一列的前 5 列提取两列值,而不抓取其余列

Extract two column values based on top 5 of one column, without grabbing the rest of the columns

我有一个 sheet 具有各种值,最重要的值:

B2 至 256 列:颜色名称
F2 至 256 列:已售商品

我需要获取前 5 个颜色名称和已售商品数量,而不获取其余列。

你提到:

...grab the top 5 color names and amount of sold items, without grabbing the rest of the columns.

阅读您的请求有多种方式

如果您的问题是:

  • 抓取前5个颜色名称(意思是销量最多的5个颜色)和销量, 使用 H3

    中的公式
    =QUERY(A1:F,"select B, sum(F) where B is not null 
               group by B order by sum(F) desc limit 5 label sum(F) 'MOST Sold' ",1)
    

如果您的问题是:

  • 获取前 5 种颜色名称(意思是出现在 B 列中的前 5 种颜色)和已售出商品数量,使用H11

    中的公式
    =QUERY(A1:F,"select B, sum(F) where B is not null and B matches '"&JOIN("|",(ARRAY_CONSTRAIN(UNIQUE(B2:B),5,1)))&"' 
               group by B order by sum(F) desc limit 5 label sum(F) 'MOST Sold' ",1)
    

(请根据需要调整范围)
如果我误解了你的问题,请分享一个测试 sheet 这样你就可以得到更容易的帮助。

使用的函数: