Lookup Field name in another table

paddydive

Active Member
Joined
Jun 30, 2010
Messages
460
Hey Guys !!

Need a quick help,

I have two tables say Table 1 and Table 2

Table 1 has column heading as Jan-1, Jan-2, Jan-3.
Table 2 has a filed name Month which has one of the value from above (Jan-1 or Jan-2 or.......)

Can we write a query which will pull all the data from Table 1 by looking at Month column in Table 2


HTML:
    Table 1       
  
    Jan-1  10    Jan-2  20    Jan-3  10    Jan-4  20 
Table 2
Month
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Do you have any control over the table structure?
This is a real good example of bad table design which makes working with them much harder than they should be.

All tables should be designed according to the Rules of Normalization (see here: https://support.microsoft.com/en-us/kb/283878)

In this case, the issue is that you should not have similar repeating fields (i.e. a column for each date).
What you should have is just two columns to address this field; one for the date, and one for the value associated with that date.
Then it is really easy to match up, as you only need to join or lookup one field, and not thirty-one (which would be an absolute nightmare!).
 
Upvote 0
Thanks Joe4 for quick reply...

Sad part is I don't have any control over the table structure. This is system generated data format I get in excel which I push to Access table 1.

Just to give you an idea its a Project wise monthly breakup of time which is in Table 1 so its like... There are several rows of data in this table 1

----------------------------------------------------
Project ID | Jan-16 | Feb - 16 | Mar-16 |
----------------------------------------------------

The Table 2 is a simple single line table where we have a simple month column like

---------.
Month |
----------
Jan-16 |
---------`

so for example I need a query which will look at the Month value in Table 2 (Jan-16) then from Table 1 give me all the project data from Jan-16 column from Table 1
 
Last edited:
Upvote 0
This is system generated data format I get in excel which I push to Access table 1.
If you are getting the data in an Excel table, you have the opportunity to "normalize" it there in Excel, before importing into Access.
You may be able to create a macro to do this automatically.

Regarding your question, I think we need to see some sample of exactly what the data looks like, and what your expected results should look like. Right now, it is very abstract, and not very clear (the devil is often in the details!).
 
Last edited:
Upvote 0

Forum statistics

Threads
1,221,783
Messages
6,161,913
Members
451,730
Latest member
BudgetGirl

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top