barkingfrog
New Member
- Joined
- Jan 18, 2005
- Messages
- 4
I’m trying to create a formula that would be capable of returning a value based on two criteria. The second of which is a date range, this is where my problem lies. I can use INDEX to return a value of a fixed criteria but not a range as I can by using VLOOKUP. I need something that can combine both and I’m struggling for a solution, so any help would be appreciated.
In basic terms, I have a list of Insurance clients in column A and a list of accident dates in column B, I need to return the policy year based on that accident date, those policy periods will change for different clients. Given one client and several accident dates, I can just use the following VLOOKUP to a table on another worksheet:- =VLOOKUP(B2,Lookups!$A$2:$B$21,2) to return the pol year.
The Table being so:-
DATE POL YEAR
21/06/1990 1990-1991
21/06/1991 1991-1992
21/06/1992 1992-1993
21/06/1993 1993-1994
21/06/1994 1994-1995
21/06/1995 1995-1996
21/06/1996 1996-1997
21/06/1997 1997-1998
21/06/1998 1998-1999
21/06/1999 1999-2000
21/06/2000 2000-2001
21/06/2001 2001-2002
21/06/2002 2002-2003
21/06/2003 2003-2004
01/04/2004 2004-2005
01/04/2005 2005-2006
01/04/2006 2006-2007
01/04/2007 2007-2008
01/04/2008 2008-2009
01/04/2009 2009-2010
However, if I have Client A,B,C,D each with different insurance periods, I have to first match the client before the lookup. If it was just one accident date, I could use an INDEX array formula in column F:-
=INDEX($C$2:$C$5,MATCH(D2,IF($B$2:$B$5=E2,$A$2:$A$5),0))
Client Accident Date Policy Year Match ClientMatch Acc Result
Client A 01/01/1990 2001 Client A 01/01/1990 2001
Client B 01/01/1991 2002 Client B 01/01/1991 2002
Client C 01/01/1992 2003 Client C 01/01/1992 2003
Client D 01/01/1993 2001 Client D 01/01/1993 2004
Is it possible to change this to a range. Failing this I can only think of having a separate worksheet for each client with the lookup table in the same range on each sheet and creating a Macro that does a find and then a lookup. Many thanks for any help given.
In basic terms, I have a list of Insurance clients in column A and a list of accident dates in column B, I need to return the policy year based on that accident date, those policy periods will change for different clients. Given one client and several accident dates, I can just use the following VLOOKUP to a table on another worksheet:- =VLOOKUP(B2,Lookups!$A$2:$B$21,2) to return the pol year.
The Table being so:-
DATE POL YEAR
21/06/1990 1990-1991
21/06/1991 1991-1992
21/06/1992 1992-1993
21/06/1993 1993-1994
21/06/1994 1994-1995
21/06/1995 1995-1996
21/06/1996 1996-1997
21/06/1997 1997-1998
21/06/1998 1998-1999
21/06/1999 1999-2000
21/06/2000 2000-2001
21/06/2001 2001-2002
21/06/2002 2002-2003
21/06/2003 2003-2004
01/04/2004 2004-2005
01/04/2005 2005-2006
01/04/2006 2006-2007
01/04/2007 2007-2008
01/04/2008 2008-2009
01/04/2009 2009-2010
However, if I have Client A,B,C,D each with different insurance periods, I have to first match the client before the lookup. If it was just one accident date, I could use an INDEX array formula in column F:-
=INDEX($C$2:$C$5,MATCH(D2,IF($B$2:$B$5=E2,$A$2:$A$5),0))
Client Accident Date Policy Year Match ClientMatch Acc Result
Client A 01/01/1990 2001 Client A 01/01/1990 2001
Client B 01/01/1991 2002 Client B 01/01/1991 2002
Client C 01/01/1992 2003 Client C 01/01/1992 2003
Client D 01/01/1993 2001 Client D 01/01/1993 2004
Is it possible to change this to a range. Failing this I can only think of having a separate worksheet for each client with the lookup table in the same range on each sheet and creating a Macro that does a find and then a lookup. Many thanks for any help given.