Excel“加入”功能 [英] Excel "Join" Function
问题描述
根据每个工作表中的ID列,我需要将两个Excel工作表中的行组合成一个长行。有效地,我想在两个工作表上执行SQL JOIN的等同生成一个组合的工作表。
I need to combine rows from two Excel worksheets into one long row, based on an ID column in each of the worksheets. Effectively I want to perform the equivilent of a SQL JOIN on two worksheets to produce a combined worksheet.
我可以在第一个工作表中获取一个Range对象,然后使用ID列获取第二个工作表中相应行的Range对象。现在我需要组合它们。
I can get a Range object for a row in the first worksheet, and then use the ID column to get a Range object for the corresponding row in the second worksheet. Now I need to combine them.
我意识到合并和联盟VBA方法,但我不认为他们做我需要的。
I am aware of Merge and Union VBA methods, however I don't think they do what I need.
如何组合这两个范围对象?
How do I combine these two range objects?
例如:
工作表1行:a,b,c
工作表2行:d,e,f
eg: worksheet 1 row: a, b, c worksheet 2 row: d, e, f
组合行:a,b,c,d,e,f
combined row: a, b, c, d, e, f
推荐答案
您可以在工作表1的列d中放置一个公式来在工作表2上执行一个vlookup来查找匹配的ID并返回值。然后对其他列e和f?再重复一次?
Can you put a formula in column d of worksheet 1 to do a vlookup on worksheet 2 to find the matching ID and return the value. Then repeat this for the other columns e and f?
这篇关于Excel“加入”功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!