Cell contents based on another cell data

mattyn

Board Regular
Joined
Apr 20, 2015
Messages
148
Hi All

I have a worksheet that shows a whole load of data summarised in the table below.

Worksheet 1

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Code[/TD]
[TD]Sub Code[/TD]
[TD]Sub Sub Code[/TD]
[TD]Details[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD][/TD]
[TD][/TD]
[TD]Title A[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]1[/TD]
[TD][/TD]
[TD]Sub Title A1[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]a[/TD]
[TD]Sub Sub Title A1a[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]b[/TD]
[TD]Sub Sub Title A1b[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD][/TD]
[TD][/TD]
[TD]Title B[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]1[/TD]
[TD][/TD]
[TD]Sub Title B1[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]a[/TD]
[TD]Sub Sub Title B1a[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]2[/TD]
[TD][/TD]
[TD]Sub Title B2[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]a[/TD]
[TD]Sub Sub Title B2a[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]b[/TD]
[TD]Sub Sub Title B2b[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD][/TD]
[TD][/TD]
[TD]Title C[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]1[/TD]
[TD][/TD]
[TD]Sub Title C1[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]a[/TD]
[TD]Sub Sub Title C1a[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]b[/TD]
[TD]
Sub Sub Title C1b
[/TD]
[/TR]
[TR]
[TD]<strike></strike>[/TD]
[TD][/TD]
[TD]c[/TD]
[TD]
Sub Sub Title C1c
[/TD]
[/TR]
[TR]
[TD]<strike></strike>[/TD]
[TD]2[/TD]
[TD][/TD]
[TD]
Sub Title C2
<strike></strike>[/TD]
[/TR]
[TR]
[TD]<strike></strike>[/TD]
[TD][/TD]
[TD]a[/TD]
[TD]
Sub Sub Title C2a
<strike></strike>[/TD]
[/TR]
[TR]
[TD]<strike></strike>[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Now, while this is a master list, I want to create a dynamic (I think) worksheet where I can enter the code (as in A, B or C) into cell A2it self populates the sub codes, sub sub codes and details of all rows pertaining to that code letter. As in as follows:

Worksheet 2

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Code[/TD]
[TD]Detail of Code[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]Title A[/TD]
[TD]I can pull Title A through by vlookup[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Sub Code[/TD]
[TD]Sub Sub Code[/TD]
[TD]Details[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD][/TD]
[TD]Sub Title A1[/TD]
[TD]I don't know how to pull though data here Sub Title A1 etc[/TD]
[/TR]
[TR]
[TD]<strike></strike>[/TD]
[TD]a[/TD]
[TD]Sub Sub Title B1a[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD][/TD]
[TD]Sub Title B2[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]a[/TD]
[TD]Sub Sub Title B2a[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]b[/TD]
[TD]Sub Sub Title B2b[/TD]
[/TR]
</tbody>[/TABLE]

or

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Code[/TD]
[TD]Detail of Code[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]Title C[/TD]
[TD]<strike></strike>I can pull Title C through by vlookup[/TD]
[TD]<strike></strike>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Sub Code[/TD]
[TD]Sub Sub Code[/TD]
[TD]Details[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD][/TD]
[TD]Sub Title C1[/TD]
[TD]
I don't know how to pull though data here Sub Title C1 etc
[/TD]
[/TR]
[TR]
[TD]<strike></strike>[/TD]
[TD]a[/TD]
[TD]Sub Sub Title C1a[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]b[/TD]
[TD]Sub Sub Title C1b[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]c[/TD]
[TD]Sub Sub Title C1c[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD][/TD]
[TD]Sub Title C2[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]a[/TD]
[TD]Sub Sub Title C2a[/TD]
[/TR]
</tbody>[/TABLE]

In summary, on worksheet 2, I want to enter the code (in cell A2 in this example) and the data from Worksheet 1 (sub code and sub sub code) pulled through in the positions shown. I can pull the data of the title by vlookup (I think)!

Also, I only want to populate rows with data if possible, as there will be static data below these tables on worksheet 2.

Does anyone know if this is possible, and if so, can you please show me how?

My other option is to have a worksheet for every code, and copy & paste the data, but I am hoping I can make it a bit slicker than that.

Very many thanks in advance, and I hope I have explained what I want simply enough!!

Matt
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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