I'm trying to reformat some data and looking for a formula that can match a value in a row, look up a value in the row, then if the cell value matches the column heading return values from a further two columns.
Here's some sample data that might make my aims clearer, I want to match the cell value under fieldName in worksheet 1 with the column name in worksheet 2 and fill the other related columns with the Source and Date values from worksheet 1.
Worksheet 1
[TABLE="width: 261"]
<colgroup><col><col><col><col><col></colgroup><tbody>[TR]
[TD]sernum[/TD]
[TD]FieldName[/TD]
[TD]Value[/TD]
[TD]Source[/TD]
[TD]Date[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]con 1[/TD]
[TD]4.0000[/TD]
[TD]bon[/TD]
[TD]16/02/2010[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[TD]con 2[/TD]
[TD]1.0000[/TD]
[TD]bon[/TD]
[TD]16/02/2010[/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[TD]con 3[/TD]
[TD].0000[/TD]
[TD]cen[/TD]
[TD]25/11/2010[/TD]
[/TR]
[TR]
[TD="align: right"]4[/TD]
[TD]con 4[/TD]
[TD].0000[/TD]
[TD]cen[/TD]
[TD]25/11/2010[/TD]
[/TR]
[TR]
[TD="align: right"]5[/TD]
[TD]con 5[/TD]
[TD].0000[/TD]
[TD]cen[/TD]
[TD]25/11/2010[/TD]
[/TR]
[TR]
[TD="align: right"]6[/TD]
[TD]con 6[/TD]
[TD]70.7700[/TD]
[TD]cen[/TD]
[TD]13/01/2011[/TD]
[/TR]
[TR]
[TD="align: right"]7[/TD]
[TD]con 7[/TD]
[TD]Yes[/TD]
[TD]cen[/TD]
[TD]21/03/2011[/TD]
[/TR]
[TR]
[TD="align: right"]8[/TD]
[TD]con 10[/TD]
[TD].0000[/TD]
[TD]cen[/TD]
[TD]13/01/2011[/TD]
[/TR]
[TR]
[TD="align: right"]9[/TD]
[TD]con 9[/TD]
[TD].0000[/TD]
[TD]cen[/TD]
[TD]30/06/2011[/TD]
[/TR]
[TR]
[TD="align: right"]10[/TD]
[TD]con 10[/TD]
[TD].0000[/TD]
[TD]cen[/TD]
[TD]30/06/2011[/TD]
[/TR]
[TR]
[TD="align: right"]11[/TD]
[TD]con 9[/TD]
[TD]19/11/2008[/TD]
[TD]bon[/TD]
[TD]16/02/2010[/TD]
[/TR]
[TR]
[TD="align: right"]12[/TD]
[TD]con 12[/TD]
[TD]21/10/1928[/TD]
[TD]bon[/TD]
[TD]29/03/2011[/TD]
[/TR]
[TR]
[TD="align: right"]13[/TD]
[TD]con 2[/TD]
[TD]30/07/1999[/TD]
[TD]bon[/TD]
[TD]16/02/2010[/TD]
[/TR]
[TR]
[TD="align: right"]14[/TD]
[TD]con 3[/TD]
[TD].0000[/TD]
[TD]bon[/TD]
[TD]11/01/2011[/TD]
[/TR]
[TR]
[TD="align: right"]15[/TD]
[TD]con 4[/TD]
[TD].0000[/TD]
[TD]bon[/TD]
[TD]13/05/2010[/TD]
[/TR]
[TR]
[TD="align: right"]16[/TD]
[TD]con 5[/TD]
[TD]1.0000[/TD]
[TD]bon[/TD]
[TD]11/01/2011[/TD]
[/TR]
[TR]
[TD="align: right"]17[/TD]
[TD]con 6[/TD]
[TD]1.0000[/TD]
[TD]bon[/TD]
[TD]13/05/2010[/TD]
[/TR]
[TR]
[TD="align: right"]18[/TD]
[TD]con 18[/TD]
[TD].0000[/TD]
[TD]bon[/TD]
[TD]11/01/2011[/TD]
[/TR]
[TR]
[TD="align: right"]19[/TD]
[TD]con 19[/TD]
[TD].0000[/TD]
[TD]bon[/TD]
[TD]13/05/2010[/TD]
[/TR]
[TR]
[TD="align: right"]20[/TD]
[TD]con 20[/TD]
[TD]M[/TD]
[TD]cen[/TD]
[TD]01/06/2011[/TD]
[/TR]
</tbody>[/TABLE]
Worksheet 2
sernum con 1 con 1 source con 1 date con 2 con 2 source con2 date con 3 con 3 source con 3 date1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Hope this makes sense, any help much appreciated
Here's some sample data that might make my aims clearer, I want to match the cell value under fieldName in worksheet 1 with the column name in worksheet 2 and fill the other related columns with the Source and Date values from worksheet 1.
Worksheet 1
[TABLE="width: 261"]
<colgroup><col><col><col><col><col></colgroup><tbody>[TR]
[TD]sernum[/TD]
[TD]FieldName[/TD]
[TD]Value[/TD]
[TD]Source[/TD]
[TD]Date[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]con 1[/TD]
[TD]4.0000[/TD]
[TD]bon[/TD]
[TD]16/02/2010[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[TD]con 2[/TD]
[TD]1.0000[/TD]
[TD]bon[/TD]
[TD]16/02/2010[/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[TD]con 3[/TD]
[TD].0000[/TD]
[TD]cen[/TD]
[TD]25/11/2010[/TD]
[/TR]
[TR]
[TD="align: right"]4[/TD]
[TD]con 4[/TD]
[TD].0000[/TD]
[TD]cen[/TD]
[TD]25/11/2010[/TD]
[/TR]
[TR]
[TD="align: right"]5[/TD]
[TD]con 5[/TD]
[TD].0000[/TD]
[TD]cen[/TD]
[TD]25/11/2010[/TD]
[/TR]
[TR]
[TD="align: right"]6[/TD]
[TD]con 6[/TD]
[TD]70.7700[/TD]
[TD]cen[/TD]
[TD]13/01/2011[/TD]
[/TR]
[TR]
[TD="align: right"]7[/TD]
[TD]con 7[/TD]
[TD]Yes[/TD]
[TD]cen[/TD]
[TD]21/03/2011[/TD]
[/TR]
[TR]
[TD="align: right"]8[/TD]
[TD]con 10[/TD]
[TD].0000[/TD]
[TD]cen[/TD]
[TD]13/01/2011[/TD]
[/TR]
[TR]
[TD="align: right"]9[/TD]
[TD]con 9[/TD]
[TD].0000[/TD]
[TD]cen[/TD]
[TD]30/06/2011[/TD]
[/TR]
[TR]
[TD="align: right"]10[/TD]
[TD]con 10[/TD]
[TD].0000[/TD]
[TD]cen[/TD]
[TD]30/06/2011[/TD]
[/TR]
[TR]
[TD="align: right"]11[/TD]
[TD]con 9[/TD]
[TD]19/11/2008[/TD]
[TD]bon[/TD]
[TD]16/02/2010[/TD]
[/TR]
[TR]
[TD="align: right"]12[/TD]
[TD]con 12[/TD]
[TD]21/10/1928[/TD]
[TD]bon[/TD]
[TD]29/03/2011[/TD]
[/TR]
[TR]
[TD="align: right"]13[/TD]
[TD]con 2[/TD]
[TD]30/07/1999[/TD]
[TD]bon[/TD]
[TD]16/02/2010[/TD]
[/TR]
[TR]
[TD="align: right"]14[/TD]
[TD]con 3[/TD]
[TD].0000[/TD]
[TD]bon[/TD]
[TD]11/01/2011[/TD]
[/TR]
[TR]
[TD="align: right"]15[/TD]
[TD]con 4[/TD]
[TD].0000[/TD]
[TD]bon[/TD]
[TD]13/05/2010[/TD]
[/TR]
[TR]
[TD="align: right"]16[/TD]
[TD]con 5[/TD]
[TD]1.0000[/TD]
[TD]bon[/TD]
[TD]11/01/2011[/TD]
[/TR]
[TR]
[TD="align: right"]17[/TD]
[TD]con 6[/TD]
[TD]1.0000[/TD]
[TD]bon[/TD]
[TD]13/05/2010[/TD]
[/TR]
[TR]
[TD="align: right"]18[/TD]
[TD]con 18[/TD]
[TD].0000[/TD]
[TD]bon[/TD]
[TD]11/01/2011[/TD]
[/TR]
[TR]
[TD="align: right"]19[/TD]
[TD]con 19[/TD]
[TD].0000[/TD]
[TD]bon[/TD]
[TD]13/05/2010[/TD]
[/TR]
[TR]
[TD="align: right"]20[/TD]
[TD]con 20[/TD]
[TD]M[/TD]
[TD]cen[/TD]
[TD]01/06/2011[/TD]
[/TR]
</tbody>[/TABLE]
Worksheet 2
sernum con 1 con 1 source con 1 date con 2 con 2 source con2 date con 3 con 3 source con 3 date1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Hope this makes sense, any help much appreciated