Searching columns

  • Thread starter Thread starter EDF2017
  • Start date Start date
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.
 
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
 
Back
Top