formula-seeker Posted July 25, 2016 Share Posted July 25, 2016 Hi All, I'm new to this forum and new to SQL. I have table in sql server " info". J2 returns the value of ID using INDEX Match formula. I want to access"Status" of ID in K2 using sql statement. When I change name in I2 cell,the ID value changed in J2 cell then the current status (that keep changing a few times in a hour ) from server "info" table should come up relating to ID available in J2 cell . like " Employed" Please see attached file for detail. I just need sql statement similar like Vlookup to access specific information from table. Thanks in Advance. Regards Link to comment Share on other sites More sharing options...
davej Posted July 25, 2016 Share Posted July 25, 2016 It isn't clear what you are talking about. In your image there are no J2 or K2 cells. Also it isn't clear how many columns are in your INFO table or if you are describing two separate tables.. Link to comment Share on other sites More sharing options...
formula-seeker Posted July 25, 2016 Author Share Posted July 25, 2016 Sorry for not being very clear. I made this post now more clear, Please ignore my first post. >Columns A to E is an example of data with headings in table "info" in sql server. >Columns H & I is an excel sheet. What i want When I add ID number in H2 cell then sql statement should access current status of this ID from table info and show up in i2 cell. Please see image, the status of ID 1 is Employed in Status Column in info table, and ID 2 is Unemployed . >if I add ID number 1 in excel sheet in cell no H2, the status Employed should show up in i2 cell. or whatever status is available. >if I change ID number in H2 and added ID number 2 , the current status should show "unemployed " or whatever is. it is same like vlookup. Please help. Thanks Link to comment Share on other sites More sharing options...
justsomeguy Posted July 25, 2016 Share Posted July 25, 2016 Is that actually a spreadsheet that you're trying to create, are you doing this in Excel or is that just an illustration? What does this have to do with SQL? Link to comment Share on other sites More sharing options...
formula-seeker Posted July 25, 2016 Author Share Posted July 25, 2016 Is that actually a spreadsheet that you're trying to create, are you doing this in Excel or is that just an illustration? What does this have to do with SQL? Thanks for asking. Basically, I want to create an excel sheet, the information in table or image is illustration coz can't post here original information. I'll use sql statement in VBA code to access required data from table in sql server. like... I have some other excel sheets using SELECT and INNER JOIN statements. Now Im looking for sql statement to work similar like VLOOKUP, just difference is that data will be accessed from table rather than other sheets. Link to comment Share on other sites More sharing options...
justsomeguy Posted July 25, 2016 Share Posted July 25, 2016 It looks like there's a guide here to connect Excel with a SQL Server database: https://support.office.com/en-us/article/Connect-a-SQL-Server-database-to-your-workbook-22c39d8d-5b60-4d7e-9d4b-ce6680d43bad It sounds like you can use something called Microsoft Query to write the SQL to add the data to your spreadsheet somewhere. https://support.office.com/en-us/article/Use-Microsoft-Query-to-retrieve-external-data-42a2ea18-44d9-40b3-9c38-4c62f252da2e Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now