Hi Andy
You have rather moved the goal posts on your request.
=IF($D2="","",VLOOKUP($D2,'[Admin.xlsx]T 09-10'!$A:$C,COLUMN(D2),0))
the generalised part of the vlookup formula is
=vlookup(lookupvalue,range_to_look_up,offset,True or False)
What I gave you initially, assumed the data as you had shown it was in
columns a, b and c
=IF($A2="","",VLOOKUP($A2,[file1.xls]Sheet1!$A:$C,COLUMN(B2),0))
where I had also assumed the point at which you were entering the Job
number was in column A of the second sheet.
I explained, that column(B2) would return a value of 2, rather than hard
coding 2 into the formula, so it would adjust as you copy the formula
across.
In my posting I had not enclosed my sheet name in single quotes as there
were no spaces. John informed you how to overcome that problem.
But you now say you want to collect data from column S of the
lookup_table. That's fine, but the lookup_range has to be extended.
Is the column containing the job number, column A on sheet 1?
if so, then the formula would be
=IF($D2="","",VLOOKUP($D2,'[Admin.xlsx]T 09-10'!$A:$Z,19,0))
or, if you were wanting to drag the formula across the page and have it
automatically adjust to pick up other data, then
=IF($D2="","",VLOOKUP($D2,'[Admin.xlsx]T 09-10'!$A:$Z,column(S2),0))
If the data were such that your Job Number was in column J of sheet2, and
the value you wanted to retrieve was still in column S, then the formula
would be
=IF($D2="","",VLOOKUP($D2,'[Admin.xlsx]T 09-10'!$J:$Z,9,0))
or
=IF($D2="","",VLOOKUP($D2,'[Admin.xlsx]T 09-10'!$A:$Z,column(I),0))
With regards to concatenating, then it would be
=IF($D2="","",VLOOKUP($D2,'[Admin.xlsx]T 09-10'!$A:$Z,19,0) &
", " & VLOOKUP($D2,'[Admin.xlsx]T 09-10'!$A:$Z,20,0))
Again, adjust the ranges and offset to suit your data layout.
--
Regards
Roger Govier
Andy said:
Thanks John
The formula sort of works but i just need to get the references right as
I'm getting #Name, but I dont fully understand the breakdown of the
syntax.
=IF($D2="","",VLOOKUP($D2,'[Admin.xlsx]T 09-10'!$A:$C,COLUMN(D2),0))
If I understand it D2 is the cell in which I type the job number. Which
then looks up values on the same row from the Admin.xlsx file. I dont
understand the remainder of the equation. I want E4 (in the main sheet)
to "populate" with the text contained in the "S" column of the same row
as the value I type in (which is in column A of the first sheet).
I could also do with "merging" two columns of data if possible. So
column "S" is an address and column "T" is a postcode which I'd like to
stick in E4 separated by a comma (i.e. "Column_S_text", "Column_T_text")