ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Associate External Data with an added column (https://www.excelbanter.com/excel-discussion-misc-queries/59645-associate-external-data-added-column.html)

cujimm

Associate External Data with an added column
 

Hi All,

I would like to associate an additional column with some information that I
get by using an external query in excel. Whenever I do the refresh, my data
columns don't always line up. Is there a way to tie the data to a particular
key.

For example, I have a customer number and their name that come from a
database. I then add an additional column called comments. I then requery
the database and my data no longer lines up if more customers were added.



bpeltzer

Associate External Data with an added column
 
Check for help on the VLOOKUP function; it retrieves data from another table
based on a common key. So you'd get your query results onto another sheet.
Then in your main table, you'd put a formula such as:
=vlookup(cust#,data_table,data_table_column,false) . That will pull back
into your main table the first comments regarding that customer from the
query results. If there are no query results for that customer, you'd get
back #N/A. You could get around that with a slightly more complex formula:
=if(isna(vlookup_function),"",vlookup_function), where vlookup_function is
the first function above (without the = sign).
Hope this points you in the right direction... --Bruce

"cujimm" wrote:


Hi All,

I would like to associate an additional column with some information that I
get by using an external query in excel. Whenever I do the refresh, my data
columns don't always line up. Is there a way to tie the data to a particular
key.

For example, I have a customer number and their name that come from a
database. I then add an additional column called comments. I then requery
the database and my data no longer lines up if more customers were added.




All times are GMT +1. The time now is 05:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com