在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/宏进行转置
发布评论