PC Review


Reply
Thread Tools Rate Thread

Create rows from a lookup

 
 
=?Utf-8?B?UmljaGFyZA==?=
Guest
Posts: n/a
 
      13th Nov 2006
Hi all,
I have 2 worksheets containing data that I need to combine, by creating rows
WS1 has product data in the range of:
Product_ID Name price Options_Ref
1 Product 1 10.00 18
2 Product 2 15.00 25
3 Product 3 5.00 18
4 Product 4 20.00 7

WS2 has the option list data such as:
Options_Ref Option_Description
7 Red
7 Blue
18 12"
18 14"
18 16"
25 White
25 Black
25 Grey
25 Cream
25 Red

What I need is to create a new worksheet that will create rows for each
option, by looking up the data. Some products use the same options so would
need to lookup,so for example:
Product_ID Name price Options_Ref Option_Description
1 Product 1 10.00 18 12"
1 Product 1 10.00 18 14"
1 Product 1 10.00 18 16"
2 Product 2 15.00 25 White
2 Product 2 15.00 25 Black
2 Product 2 15.00 25 Grey
2 Product 2 15.00 25 Cream
2 Product 2 15.00 25 Red
3 Product 3 5.00 18 12"
3 Product 3 5.00 18 14"
3 Product 3 5.00 18 16"


I hope I have explained my needs OK, hope somebody can help me
 
Reply With Quote
 
 
 
 
Herbert Seidenberg
Guest
Posts: n/a
 
      15th Nov 2006
This procedure repeats a row a given, variable amount of times,
using reverse Pivot Table.
Assume your data and headers are arranged like this, starting at A1

Prod_ID Prod_NM Price Opt_Ref Prod_ID2
1 Prod1 10 18 1 0 0 12" 14" 16" 0 0 0 0 0
2 Prod2 15 25 2 0 0 0 0 0 Wt Blk Gry Crm Red
3 Prod3 5 18 3 0 0 12" 14" 16" 0 0 0 0 0
4 Prod4 20 7 4 Rd Bu 0 0 0 0 0 0 0 0

Opt_ref2 Opt_des2
7 Rd
7 Bu
18 12"
18 14"
18 16"
25 Wt
25 Blk
25 Gry
25 Crm
25 Red

Notice that column E is a repeat of A.
In F2:O2 enter this array formula:
=TRANSPOSE(IF(Opt_ref2=D2,Opt_des2,0))
and fill down.
Use reverse Pivot Table on E1:O5. See:
http://j-walk.com/ss/excel/usertips/tip068.htm
In the resulting Row/Column/Value table, insert 2 more blank Columns
and delete zeros with
Edit > Go To > Special > Constants > Numbers
(or Logicals if ,0 is omitted in the above formula)
Delete > Shift up > Entire Row
Fill the first row of the 3 blank columns with this array formula
with this format:
=VLOOKUP(......,A25,{2,3,4})
and fill down.

 
Reply With Quote
 
=?Utf-8?B?UmljaGFyZA==?=
Guest
Posts: n/a
 
      17th Nov 2006
Many thanks for your reply Herbert.
I have been trying your suggestion & have been unable to get it working.
I am having trouble with the IF statement in the TRANSPOSE formula.
In your reply you have referred to Opt_ref2 & Opt_des2, I know what these
are referring to but in excel do I need to declare the cell range inplace of
these ie A1:A7 etc or are they variable that the data range needs declaring
in?

Many thanks
Richard

"Herbert Seidenberg" wrote:

> This procedure repeats a row a given, variable amount of times,
> using reverse Pivot Table.
> Assume your data and headers are arranged like this, starting at A1
>
> Prod_ID Prod_NM Price Opt_Ref Prod_ID2
> 1 Prod1 10 18 1 0 0 12" 14" 16" 0 0 0 0 0
> 2 Prod2 15 25 2 0 0 0 0 0 Wt Blk Gry Crm Red
> 3 Prod3 5 18 3 0 0 12" 14" 16" 0 0 0 0 0
> 4 Prod4 20 7 4 Rd Bu 0 0 0 0 0 0 0 0
>
> Opt_ref2 Opt_des2
> 7 Rd
> 7 Bu
> 18 12"
> 18 14"
> 18 16"
> 25 Wt
> 25 Blk
> 25 Gry
> 25 Crm
> 25 Red
>
> Notice that column E is a repeat of A.
> In F2:O2 enter this array formula:
> =TRANSPOSE(IF(Opt_ref2=D2,Opt_des2,0))
> and fill down.
> Use reverse Pivot Table on E1:O5. See:
> http://j-walk.com/ss/excel/usertips/tip068.htm
> In the resulting Row/Column/Value table, insert 2 more blank Columns
> and delete zeros with
> Edit > Go To > Special > Constants > Numbers
> (or Logicals if ,0 is omitted in the above formula)
> Delete > Shift up > Entire Row
> Fill the first row of the 3 blank columns with this array formula
> with this format:
> =VLOOKUP(......,A25,{2,3,4})
> and fill down.
>
>

 
Reply With Quote
 
Herbert Seidenberg
Guest
Posts: n/a
 
      18th Nov 2006
In my example Opt_ref2 and Opt_des2 are the arbitrary names
for the ranges A7:A16 and B7:B16
So if you did not name these ranges with
Insert > Name > Create > Top Row
then you could have written the formula this way:
=TRANSPOSE(IF($A$7:$A$16=D2,$B$7:$B$16,0))
To me, the first way is easier to read, is independent of
the data location you chose and you don't have to worry
about absolute and relative references.
Select F2:O2 (10 cells, the number of cells in Opt_ref2),
type the formula and hit Ctrl+Shift+Enter instead of just Enter.
Experiment with my setup before you tackle yours.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
lookup a value across 15 rows NotanExcelGuru Microsoft Excel Misc 4 13th May 2009 11:09 PM
lookup a value across 15 rows NotanExcelGuru Microsoft Excel Misc 0 13th May 2009 10:33 PM
Convert columns to rows: create duplicate rows based on column val =?Utf-8?B?Q2FycmllUg==?= Microsoft Access 3 30th Aug 2006 07:07 PM
Can I filter rows or create aggregate rows with DataTable? =?Utf-8?B?TXJOb2JvZHk=?= Microsoft C# .NET 3 22nd Oct 2004 05:05 PM
IF , LOOKUP, Then SUM across rows Microsoft Excel Worksheet Functions 0 28th Apr 2004 02:56 AM


Features
 

Advertising
 

Newsgroups
 


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