Excel - 获取列的前 5 个数据及其匹配的标题,但会产生重复项 [英] Excel - Getting the Top 5 data of a column and their matching title but produces duplicates

查看:16
本文介绍了Excel - 获取列的前 5 个数据及其匹配的标题,但会产生重复项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个使用 PHP(以 CodeIgniter 作为框架)制作的 Web 应用程序,它应该生成一个 excel 文件报告作为数据摘要.

I am developing a web application made using PHP (withh CodeIgniter as the framework) that should produce an excel file report as as summary of data.

我使用 PHPSpreadsheet 作为库来生成 .xlsx 文件,一切都成功了.

I am using PHPSpreadsheet as a library to generate the .xlsx file and everything is successful.


我能够在一定范围的单元格中显示一列的前 5 个值,即.文章数量最多的前 5 个出版物.

I was able to display in a certain range of cell the top 5 values of a column ie. Top 5 Publications that has the most number of Articles.

使用代码 =LARGE(ColumnOfTheDataRange , NumeralValue) -- 我能够获得我想要的前 5 名

With the use of the code =LARGE(ColumnOfTheDataRange , NumeralValue) -- I was able to get the top 5 of what I wanted


然后,在这前 5 个数据的左侧,我需要显示匹配的出版物名称/出版物.我能够使用函数 =INDEX(PublicationNamesCellRange, MATCH(CellOfTheMatchingData, ColumnOfTheDataCellRange, 0))


现在,请注意在前 5 个数据列(右)中有多个文章计数54,它们应该属于 2 个不同的出版物.问题是,我应该使用什么代码或技术来生成唯一的出版物名称,以便它不会重复出版物名称 E,因为在原始 excel 文件中,出版物名称 E 是第一个匹配54的数据?

Now, kindly notice that there are multiple article counts 54 in the top 5 data column (right), which should belong to 2 different Publications. The problem is, what code or technique should I use to produce the unique Publication Name so that it won't repeat the Publication Name E because in the original excel file, the Publication Name E is the first one that has the matching data of 54?

推荐答案

这是我最终使用的,根据您的情况编辑.

This is what I ended up using, edit to your situation.

这篇关于Excel - 获取列的前 5 个数据及其匹配的标题,但会产生重复项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆