Searching columns

E

EDF2017

Hi,

Here is the challenge I'm having. I have 3 columns of data (A, B, C for
example) and what I need to do is search column B to see if there is a match
for a cell in column A and then display the corresponding data from column C.
Below is hopefully a clearer example:
A B C D
553 965 10
112 553 6

I need to see if there is an exact match for cell A1 (553) in column C.
Since C2 matchs, I need to display D2 beside A1. If there is no match I just
need the space to be left blank (so B2 would be left blank). I hope this
makes sense and somebody can help.
 
B

Bill Mosca

Are you talking about Excel or are you just using Excel terminology? You do
know you are in an MS Access group right?

If you really mean a table with records, you can get your results this way:
Create a query for your table. Add the same table again to the query and
join the tables on the field A joined to field C. Then include the primary
keys from both instances of the table.

The SQL would look something like this:
SELECT MyTable.MyPK,
MyTable.Field1,
MyTable_1.MyPK,
MyTable_1.Field2
FROM MyTable
INNER JOIN MyTable AS MyTable_1
ON MyTable.Field1 = MyTable_1.Field2
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top