Find and Replace with lookup table with mutiple conditions (Categories)

Shayla19

New Member
Joined
Jun 25, 2018
Messages
1
I have two sheets: the first with data with column headers as 'Line#s' I need to change based off of a lookup table on the second sheet. Both tables have an overall category (ID) and sub-category (Type). The header names in the lookup table vary depending both categories. I need a condition statement to choose the correct value that looks at the category values and make sure they match. My first table looks something like this:
ID
Type
Line13
Line17
421
B
123
234
421
B
456
124

<tbody>
</tbody>
The lookup table is large with values for multiple ID's and Types like follows:
ID
Type
Line #
Gas
421
A
13
H2O
421
A
17
CO2
421
B
13
H2
421
B
17
CO2
421
C
17
O2
556
A
13
N20
556
B
13
H2
556
C
13
CO2

<tbody>
</tbody>
Therefore the result should find the corresponding gas name for the Line # and replace it looking like this:
ID
TypeH2
CO2
421
B
123
234
421
B
456
124

<tbody>
</tbody>

The incoming data usually has a single ID with multiple types but I have acquired code to break up the data into multiple sheets each with one ID and one Type to make the column header change valid.

Help would be tremendously appreciated! I am new to VBA and do not understand the language
 

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)
IDTypeLine13Line17col I
421B123234
421B456124
The lookup table is large with values for multiple ID's and Types like follows:
ID
TypeLine #Gas
421A13H2O421A13row 6
421A17CO2421A17
421B13H2421B13
421B17CO2421B17
421C17O2421C17
556A13N20556A13
556B13H2556B13
556C13CO2556C13col M
Therefore the result should find the corresponding gas name for the Line # and replace it looking like this:
ID
TypeH2LINE13LINE17
421B123234421B13421B17row 18
421B456124
the H2 header above is obtained by
the 421B13 above is derived by
=OFFSET($I$6, MATCH($M$18,$I$7:$I$14,0),-5)
=A18&B18&RIGHT(M17,2)

<colgroup><col span="18"></colgroup><tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,214,982
Messages
6,122,580
Members
449,089
Latest member
Motoracer88

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