We’d like to remind Forumites to please avoid political debate on the Forum.
This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
The Forum now has a brand new text editor, adding a bunch of handy features to use when creating posts. Read more in our how-to guide
Excel, Returning Two Values
Cotta
Posts: 3,667 Forumite
in Techie Stuff
Hi All,
I have a table within Excel with a simple formula that allows me to search a link a name within that table with another table and to return to corresponding value. Below is the formula I use:
=VLOOKUP(A40,$I:$N,3,FALSE)
However my problem with this is that it only returns the valued linkled to the first name and sometimes there are more than one matching name and I would like to return all such values - is this pobbile?
I have a table within Excel with a simple formula that allows me to search a link a name within that table with another table and to return to corresponding value. Below is the formula I use:
=VLOOKUP(A40,$I:$N,3,FALSE)
However my problem with this is that it only returns the valued linkled to the first name and sometimes there are more than one matching name and I would like to return all such values - is this pobbile?
0
Comments
-
simplest way would be to perform the vlookup from the original first table to the second and then pivot for results, excluding the n/a bits
Otherwise, write a looping macro that searches through the original first table for the values and populates the second. If you tell the macro to search til the end of the table, and record any duplicates, then you could populate values from the duplicates in the fields to the right in the second table. First options seems a lot easier!!School is important, but Rugby is importanter.0 -
Not with vLookUp, it is designed to only bring back the first one.
By the sounds of it you are getting more into the territory of a database than a spreadsheet. There are none ideal ways to do it but would help to have more context.0 -
I got curious and continued searching. Here's some text from another site:
For 2007+ use Data > From Other Sources > From Microsoft Query:
choose Excel File and select your 1st excel
choose columns (if you don't see any list of columns, make sure to check Options > System Tables)
edit the Data > Connections > choose your new connection > Properties > Definition > Command text
you can now edit this Command text as SQL, i tried implicit joins, "inner join", "left join" and unions:
SELECT *
FROM `C:\Users\Peter\Documents\Excel-to-excel\Source_1.xlsx`.`Sheet1$` a
LEFT JOIN `C:\Users\Peter\Documents\Excel-to-excel\Source_2.xlsx`.`Sheet1$` b
ON a.col2 = b.col2
If you know your way around SQL you might well get this to workSchool is important, but Rugby is importanter.0 -
This discussion has been closed.
Confirm your email address to Create Threads and Reply
Categories
- All Categories
- 353.5K Banking & Borrowing
- 254.2K Reduce Debt & Boost Income
- 455K Spending & Discounts
- 246.6K Work, Benefits & Business
- 602.9K Mortgages, Homes & Bills
- 178.1K Life & Family
- 260.6K Travel & Transport
- 1.5M Hobbies & Leisure
- 16K Discuss & Feedback
- 37.7K Read-Only Boards