[英]Excel macro to move data from one sheet to another based column name and cell content
I have a worksheet1 with a column labeled participant and columns labeled 1-20 (experiment ID numbers). 我有一个工作表1,其中的一列标记为参与者,一列标记为1-20(实验ID号)。
I have another worksheet2 with data of participants (column) and the experiments (column) they participated in. 我还有另一个工作表2,其中包含参与者(列)和他们参与的实验(列)的数据。
What I need to do is place an "X", on worksheet1, in the corresponding cells from worksheet2. 我需要做的是在worksheet1上的worksheet2的相应单元格中放置一个“ X”。
Here are some images that show what I mean: 以下是一些图片,这些图片说明了我的意思:
You should use a pivot table. 您应该使用数据透视表。 It will get you exactly what you are looking for. 它会为您提供所需的确切信息。
Row Label: Participant
Col Label: Experiment
Values: Count of Experiment
Then you would need to change all the "1"s to "X" with find/replace (either manually or with macro): 然后,您需要使用查找/替换(手动或使用宏)将所有的“ 1”更改为“ X”:
Range(pivottablecells).Replace("1", "X")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.