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

查看:207
本文介绍了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))


Then, on the left side of these top 5 data, I need to display the matching Publication Names / Publications. I was able to do it with the function =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天全站免登陆