ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Match name and Date Period for % (https://www.excelbanter.com/excel-discussion-misc-queries/146283-match-name-date-period-%25.html)

aggregate sum over the periods

Match name and Date Period for %
 
In sheet 1
Name Date %
u 31-Mar-07 3.00%
P 30-Mar-07 1.20%
w 06-May-07 4.50%
w 10-Jun-07 #N/A


In Sheet 2
Name % Start End
p 1.2% 01-Jan-07 31-Mar-07
u 3.0% 09-Feb-07 06-May-07
w 4.5% 06-May-07 08-Jun-07

=INDEX(Sheet2!$B$2:$B$4,MATCH(1,(A1=Sheet2!$A$2:$A $4)*(B1=Sheet2!$C$2:$C$4)*(B1<=Sheet2!$D$2:$D$4), 0))

It is found that if the date specified is out of the range of Sheet 2, we
got the result "#N/A". How could I change it to zero instead of "#N/A" for
my further calculation.

Thanks in advance

Mike H

Match name and Date Period for %
 
Try:-

IF(ISERROR(INDEX(Sheet2!$B$2:$B$4,MATCH(1,(A2=Shee t2!$A$2:$A$4)*(B2=Sheet2!$C$2:$C$4)*(B2<=Sheet2!$ D$2:$D$4),0))),"0",INDEX(Sheet2!$B$2:$B$4,MATCH(1, (A2=Sheet2!$A$2:$A$4)*(B2=Sheet2!$C$2:$C$4)*(B2<= Sheet2!$D$2:$D$4),0)))

Mike

"aggregate sum over the periods" wrote:

In sheet 1
Name Date %
u 31-Mar-07 3.00%
P 30-Mar-07 1.20%
w 06-May-07 4.50%
w 10-Jun-07 #N/A


In Sheet 2
Name % Start End
p 1.2% 01-Jan-07 31-Mar-07
u 3.0% 09-Feb-07 06-May-07
w 4.5% 06-May-07 08-Jun-07

=INDEX(Sheet2!$B$2:$B$4,MATCH(1,(A1=Sheet2!$A$2:$A $4)*(B1=Sheet2!$C$2:$C$4)*(B1<=Sheet2!$D$2:$D$4), 0))

It is found that if the date specified is out of the range of Sheet 2, we
got the result "#N/A". How could I change it to zero instead of "#N/A" for
my further calculation.

Thanks in advance


aggregate sum over the periods

Match name and Date Period for %
 
Thanks. I got the result .

"Mike H" wrote:

Try:-

IF(ISERROR(INDEX(Sheet2!$B$2:$B$4,MATCH(1,(A2=Shee t2!$A$2:$A$4)*(B2=Sheet2!$C$2:$C$4)*(B2<=Sheet2!$ D$2:$D$4),0))),"0",INDEX(Sheet2!$B$2:$B$4,MATCH(1, (A2=Sheet2!$A$2:$A$4)*(B2=Sheet2!$C$2:$C$4)*(B2<= Sheet2!$D$2:$D$4),0)))

Mike

"aggregate sum over the periods" wrote:

In sheet 1
Name Date %
u 31-Mar-07 3.00%
P 30-Mar-07 1.20%
w 06-May-07 4.50%
w 10-Jun-07 #N/A


In Sheet 2
Name % Start End
p 1.2% 01-Jan-07 31-Mar-07
u 3.0% 09-Feb-07 06-May-07
w 4.5% 06-May-07 08-Jun-07

=INDEX(Sheet2!$B$2:$B$4,MATCH(1,(A1=Sheet2!$A$2:$A $4)*(B1=Sheet2!$C$2:$C$4)*(B1<=Sheet2!$D$2:$D$4), 0))

It is found that if the date specified is out of the range of Sheet 2, we
got the result "#N/A". How could I change it to zero instead of "#N/A" for
my further calculation.

Thanks in advance



All times are GMT +1. The time now is 12:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com