简体   繁体   English

EXCEL - 如果行不为空,则获取多个列标题

[英]EXCEL - Get mutiple column headers if row is not blank

I have an excel file with the table below, there are about 20 columns and 100 rows我有一个带有下表的 excel 文件,大约有 20 列和 100 行

Header1页眉1 Header2页眉2 Header3页眉3 Header4页眉4 Header5页眉5
Name 1名称 1 A一个 B AA AA
Name 2名称 2 A一个 C C
Name 3名称 3 B A一个 AB AB A一个
Name 4名称 4 C C A一个 B

I need to get the column headers where cells have value and list them in a seperated sheet, seperated cell.我需要获取单元格具有值的列标题并将它们列出在单独的工作表中,单独的单元格中。 Below is what I want.下面是我想要的。

Name 1名称 1 Header1页眉1 Header2页眉2 Header5页眉5
Name 2名称 2 Header2页眉2 Header4页眉4
Name 3名称 3 Header1页眉1 Header2页眉2 Header3页眉3 Header5页眉5
Name 4名称 4 Header2页眉2 Header3页眉3 Header4页眉4

Is there a function that I can use?有我可以使用的 function 吗? VBA is okay too. VBA 也可以。 Any help would be greatly appreciated.任何帮助将不胜感激。 Thank you.谢谢你。

With Excel 365 you can try-使用Excel 365您可以尝试-

=TRANSPOSE(FILTER(TRANSPOSE($B$1:$F$1),INDEX(TRANSPOSE($B$2:$F$5),,MATCH(H2,$A$2:$A$5,0))<>0))

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM