Hi scr,
For Text and Numbers use...
=IF(SUMPRODUCT(--(Sheet2!$A$2:$A$11=$A2),--(Sheet2!$B$2:$B$11=$B2),--
(Sheet2!$C$2:$C$11=$C2))<>0,OFFSET(Sheet2!$A$1,SUMPRODUCT(--(Sheet2!$A
$2:$A$11=$A2),--(Sheet2!$B$2:$B$11=$B2),--(Sheet2!$C$2:$C$11=
$C2),ROW(Sheet2!D$2
$11))-1,COLUMNS($A:C)),D2)
It's an IF function.
The condition being tested can be expressed as...
"Are the values on this row in columns A, B and C the same as the
corresponding values in any of the rows of the sheet with the reroute
data?
eg On this row A="John",B="Smith" and C="Teacher". Is there a row on
the reroute sheet where A="John",B="Smith" and C="Teacher"?
This test is carried out by...
SUMPRODUCT(--(Sheet2!$A$2:$A$11=$A2),--(Sheet2!$B$2:$B$11=$B2),--
(Sheet2!$C$2:$C$11=$C2)<>0
When the result of the test is TRUE the SUMPRODUCT function...
SUMPRODUCT(--(Sheet2!$A$2:$A$11=$A2),--(Sheet2!$B$2:$B$11=$B2),--
(Sheet2!$C$2:$C$11=$C2),ROW(Sheet2!D$2
$11))
tells the OFFSET function which row on the reroute sheet has columns
A, B and C the same as those on the row with the formula.
The OFFSET function is anchored at Sheet2!$A$1 and it returns the
value on the reroute sheet on the row with the same A,B and C values
(the row offset argument is 1 less than the actual row where the
correct values were located by the SUMPRODUCT function).
The column offset argument is given by...
COLUMNS($A:C)
increments to COLUMNS($A
) then COLUMNS($A:E) etc as the formula is
filled across the five columns so that the different reroute columns
are referred to.
COLUMNS($A:C)=3
COLUMNS($A
)=4
COLUMNS($A:E)=5 etc
When the result of the test is FALSE the original data in column D is
returned. As the formula is filled across to the other 4 columns this
changes to E, F, G then H.
See...
http://www.xldynamic.com/source/xld.SUMPRODUCT.html
for excellent explanation of the SUMPRODUCT function
Ken Johnson