Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Let's say that I have two workbooks: File X and File Y. (both .csv files) I am looking to create a Macro that copies from a certain cell in File X to a specific cell in File Y. This would be done based off a query.

Example: Compares all values listed in Column A of File X to all values listed in Column A of File Y. If value matches in column A in both files (let’s say: IF ID = 5), it then retrieves information from Column J of File X for that row and pastes it in the corresponding row of File Y Column J.

Is this possible? And if so, how could one do this?

share|improve this question
1  
Sounds like you need VBA! – Breakthrough Dec 18 '12 at 20:04
VBA? @Breakthrough – Tyler Dec 18 '12 at 20:17

closed as not a real question by ChrisF, Breakthrough, techie007, Oliver Salzburg Dec 19 '12 at 0:29

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.

1 Answer

Yes and I think a macro is not necessary. If I understand your requirement

 =IFERROR(VLOOKUP(MATCH(A2,X!$A$2:$A$11,0),X!$A$1:$J$11,10),"")  

(assuming Row1 in X is labels and another 10 rows are occupied) should suit, in ColumnJ of Y and copied down.

Displays blank ("") if a match is not found, otherwise looks up the matching value and displays the value nine columns to its right.

share|improve this answer
Does the statement not need anything regarding file Y in it? – Tyler Dec 18 '12 at 20:32
File Y is 'assumed' because it is the current worksheet/book - so you could add Y! before A2, but there is no need. And the formula is in Y (Row2 assumed), so that is where the result should display. – pnuts Dec 18 '12 at 20:35
Let me try this and get back to you. Seems to query something! – Tyler Dec 18 '12 at 20:51
It didn't create any results. I ran the file in Y (since it's assumed) but it didn't pull information from X? – Tyler Dec 18 '12 at 20:57
Is X open? You need the full path to it. – pnuts Dec 18 '12 at 20:58
show 4 more comments

Not the answer you're looking for? Browse other questions tagged or ask your own question.