#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default Lookup Problem

I have a list of years belonging to different depts with numbers for internal
sales goals. I want to have a variable field to enter the correct year and
have it display the dept names and numbers for that year. Example:

A B C D
Year Dept Plan Actual
1 2007 CL 12 8
2 2007 PL 20 18
3 2006 CL 17 15
4 2006 PL 14 12

I want to enter a year in the variable cell ("2007") and have it return the
information pertaining to that year in some adjacent columns.


Year Dept Plan Actual
1 2007 CL 12 8
2 2007 PL 20 18


I tried putting in the following formula in each cell in the adjacent columns:
=INDEX($B$15:$F$35,INDEX(IF($B$15:$B$35=$B$8,ROW($ B$15:$B$35)),ROW(1:1)),3).

I copied the formula to all of the cells necessary to display each dept
name, plan and actual. It works for one year only. If I change the variable
cell to 2006, all works. If I try a different year, I get #REF! errors.




  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Lookup Problem

The easiest way to do this is to use a filter and filter on the year.

If you want a formula...

This range named table:

2007 CL 12 8
2007 PL 20 18
2006 CL 17 15
2006 PL 14 12


B8 = 2006

Enter this array formula** in C8 (?) and copy across to F8 then down until
you get blanks:

=IF(ROWS(C$8:C8)<=COUNTIF(Year,$B$8),INDEX(table,S MALL(IF(Year=$B$8,ROW(table)-MIN(ROW(table))+1),ROWS(C$8:C8)),COLUMNS($C8:C8)), "")

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER)


--
Biff
Microsoft Excel MVP


"CCripe" wrote in message
...
I have a list of years belonging to different depts with numbers for
internal
sales goals. I want to have a variable field to enter the correct year
and
have it display the dept names and numbers for that year. Example:

A B C D
Year Dept Plan Actual
1 2007 CL 12 8
2 2007 PL 20 18
3 2006 CL 17 15
4 2006 PL 14 12

I want to enter a year in the variable cell ("2007") and have it return
the
information pertaining to that year in some adjacent columns.


Year Dept Plan Actual
1 2007 CL 12 8
2 2007 PL 20 18


I tried putting in the following formula in each cell in the adjacent
columns:
=INDEX($B$15:$F$35,INDEX(IF($B$15:$B$35=$B$8,ROW($ B$15:$B$35)),ROW(1:1)),3).

I copied the formula to all of the cells necessary to display each dept
name, plan and actual. It works for one year only. If I change the
variable
cell to 2006, all works. If I try a different year, I get #REF! errors.






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
lookup problem Jaan Excel Worksheet Functions 2 January 24th 08 02:14 PM
lookup problem. MyFairLady Excel Worksheet Functions 3 January 31st 07 10:33 PM
Lookup problem RD Wirr Excel Worksheet Functions 4 February 8th 06 01:14 PM
LOOKUP Problem grey Excel Worksheet Functions 4 December 30th 05 09:17 AM
LOOKUP problem!!! G Excel Worksheet Functions 1 August 20th 05 12:02 AM


All times are GMT +1. The time now is 08:19 AM.

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"