如何在数组中搜索并总结与数组中匹配值有关的相应值?

发布于 2025-02-13 19:57:28 字数 742 浏览 0 评论 0原文

因此,这是假定数据,其中列B,C,D和E 具有标签。这些列中的每一个都有可能与标签列中的标签匹配的标签。例如, b2 中的值可以与 e12 中的值相同。可以在列B,C,D和E 上观察到相同的情况。然后是w_score 列F ,其中分数按照等级分配。另外,还有一个名为unique_tag列g ,它在列B,c,d和e 中赋予了整个标签名称的唯一值。 目的是找出“ p_score”列中unique_tags的w_score的总和。

注意:应在标签名称( b,c,d和e )的数组中搜索unique_tag,并相应的w_score列)的总和F )应计算以找到p_score(在列H 中)。

p_score suoliday_tag的示例示例(gitg1:10+8.5+5+5+4.5 = 28 请参阅下图: 假定数据的dataframe

So, here is the pretend data where columns B, C, D and E have tags. Each of these column has tags which might match the tags in tags column. For example, the value in B2 can be the same as the value in E12. The same can be observed across columns B, C, D and E. Then there's w_score column F where the score is alloted in accordance with the rank. Also, there's a column G which is named unique_tag which gives the unique value throughout the tag names in columns B, C, D and E.
The objective is to find out the sum of the w_score of the unique_tags in the column p_score.

Note: The unique_tag should be searched across the array where lies the tag names (column B, C, D and E) and sum of the corresponding w_score (column F) should be calculated in order to find the p_score (in column H).

Sample Example for p_score of unique_tag(git) G1: 10+8.5+5+4.5= 28
Please refer the image below:
Dataframe of the pretend data

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

暖心男生 2025-02-20 19:57:28

Sumif函数不会在数组中搜索(即在多个列中),尽管我们可以使用SUMIF使用操作员来汇总多个列搜索标准。简而言之,我使用= sumif($ b $ 2:$ b $ 15,g2,$ f $ 2:$ f $ 15)+sumif($ c $ 2:$ c $ 15,g2,g2,$ f $ 2:$ f $ 15)+sumif($ d $ 2:$ d $ 15,g2,$ f $ 2:$ f $ 15)+sumif($ e $ 2:$ e $ e $ 15,g2,g2,g2, $ f $ 2:$ f $ 15)

SUMIF function doesn't search in an array (i.e. in multiple columns), although we can use the operator using SUMIF to aggregate the multiple columns search-in criteria. Simply, I got the desired output using =SUMIF($B$2:$B$15, G2, $F$2:$F$15)+SUMIF($C$2:$C$15, G2, $F$2:$F$15)+SUMIF($D$2:$D$15, G2, $F$2:$F$15)+SUMIF($E$2:$E$15, G2, $F$2:$F$15)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文