Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default pull data from one table to another if multiple conditions are met

I have two tables. One has a column for State and a column for Month/Year.
The other table has a column for State, a column for beginning period and a
column for ending period. There are other columns in each table. When the
Month/Year in the first table falls between the beginning and ending period
in the second table and the State is the same, I want to pull a value from
the second table to the first table. Can Excel do it? How?

Table 1 (thousands of records with different State and Month/Year)
NY 03/2004
NY 05/2005
....
CA 08/2003
CA 10/2004
....

Table 2
NY 01/2001 12/2003 rate1
NY 01/2004 12/2006 rate2
....
CA 01/2001 12/2003 rate3
CA 01/2004 12/2006 rate4
....

The target result should be

NY 03/2004 rate2
NY 05/2005 rate2
....
CA 08/2003 rate3
CA 10/2004 rate4
....


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default pull data from one table to another if multiple conditions are met

Use a helper column, say E, in Table 2, with formula
=VALUE(RIGHT(B2,4)&LEFT(B2,2))
filled down as required (results shall be numbers: 200101, 200401, ...).

Enter formula
=INDEX(OFFSET(INDIRECT(ADDRESS(MATCH($A2,Table2!$A :$A,0),4,4,1,"Table2")),0,0,COUNTIF(Table2!$A:$A,$ A2),1),$E1)

in C2 of Table 1, where Table2 is the sheet name containing Table 2. Fill it
down as required.

It works only if rows are sorted by state and month/year like in your example!

Regards,
Stefi

€žIcyhot€ť ezt Ă*rta:

I have two tables. One has a column for State and a column for Month/Year.
The other table has a column for State, a column for beginning period and a
column for ending period. There are other columns in each table. When the
Month/Year in the first table falls between the beginning and ending period
in the second table and the State is the same, I want to pull a value from
the second table to the first table. Can Excel do it? How?

Table 1 (thousands of records with different State and Month/Year)
NY 03/2004
NY 05/2005
...
CA 08/2003
CA 10/2004
...

Table 2
NY 01/2001 12/2003 rate1
NY 01/2004 12/2006 rate2
...
CA 01/2001 12/2003 rate3
CA 01/2004 12/2006 rate4
...

The target result should be

NY 03/2004 rate2
NY 05/2005 rate2
...
CA 08/2003 rate3
CA 10/2004 rate4
...


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,180
Default pull data from one table to another if multiple conditions aremet

Excel 2007 Tables
No sorting needed.
No volatile functions (offset, indirect).
English readable formulas.
http://www.mediafire.com/file/vnajtgljaom/09_17_09.xlsx
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default pull data from one table to another if multiple conditions are

Brilliant! Thanks a lot!

"Herbert Seidenberg" wrote:

Excel 2007 Tables
No sorting needed.
No volatile functions (offset, indirect).
English readable formulas.
http://www.mediafire.com/file/vnajtgljaom/09_17_09.xlsx

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
can a pivot table pull from multiple worksheets? Todd Excel Worksheet Functions 1 June 23rd 06 01:23 AM
Pull Pivot Table Data Dave Excel Discussion (Misc queries) 0 May 23rd 06 03:11 PM
Pull pivot table data Dave Excel Discussion (Misc queries) 1 May 20th 06 01:01 AM
look up table values with multiple conditions TechMGR Excel Discussion (Misc queries) 3 January 10th 06 12:52 AM
Pull multiple data luk_sr Excel Worksheet Functions 6 August 2nd 05 09:20 PM


All times are GMT +1. The time now is 02:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"