使用Vlookup/宏进行转置

编程入门 行业动态 更新时间:2024-10-19 15:24:39
本文介绍了使用Vlookup/宏进行转置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在Excel中,我在每行的单独列中具有唯一的人员及其各种角色的列表,如下所示:

In Excel, I have a unique listing of people and their various roles that they hold in separate columns within each row as following:

名称角色角色角色角色角色 约翰BC空空简DC空空空丽莎BCFG

Name Role Role Role Role Role John A B C null null Jane D C null null null Lisa A B C F G

我想为每个唯一的名称"转置所有角色,以使名称-角色"的每种组合都有一行,如下所示:

I want to transpose all the roles for each unique 'Name' so that there is a row for each combination of Name - Role as follows:

名称角色 约翰A 约翰B 约翰C 简D 简C 丽莎A 丽莎B 丽莎C 丽莎F 丽莎G

Name Role John A John B John C Jane D Jane C Lisa A Lisa B Lisa C Lisa F Lisa G

是否可以使用功能或宏的任何组合来在另一张工作表或同一电子表格中获得此输出?即使转置的行包含空值,我也可以删除所有结尾为空值的行.我大约有30多个用户,许多人要尝试分离20多个角色,因此,如果有自动化的方法,这可以节省我的时间.

Is there any combination of functions or macros I can utilize to get this output in another sheet or the same spreadsheet? Even if the transposed rows includes null values, I can go in and delete all rows with blank values at the end. I have about 30+ users and many have 20+ roles that I'm trying to separate so this may save me time if there's an automated way to do it.

推荐答案

在H2中:

=OFFSET($A$1,CEILING((ROW()-1)/COUNTA($B$1:$F$1),1),0)

在I2中:

=VLOOKUP(H2,$A$2:$F$4,COUNTIF(H$2:H2,H2)+1,FALSE)

把两者都填满.

更多推荐

使用Vlookup/宏进行转置

本文发布于:2023-10-27 11:09:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1533196.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Vlookup

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!