If/Then Matrix? Can Excel do this?

  • Thread starter Thread starter D
  • Start date Start date
D

D

Hey guys- got a semi-easy one here...

I have a range of dates that I need a specific code associated with each
year. For example- if the year is 1982, the code to use in this cell is
..9445. If the year is 1993, the code is .9669, and so on. This will run in a
macro eventually. How/where do I write this, and, can Excel do something
like this? IE- can Excel 'store' a 'matrix' of codes for each year? I hope
this is making sense.
Bbtw, it doesnt HAVE TO work in a macro- it'd be pretty cool if it could
actually work automatically as soon as the date was entered into a specific
cell, but a macro would work too... THANKS!
Thanks!
D
 
One way:

Assume your matrix of dates and codes are in Sheet2, Cells A1:Bx, with
the dates in column A and codes in column B. Back in Sheet 1, assume the
entry cell is A1, then put this in B1:

=IF(A1<>"",VLOOKUP(A1,Sheet2!A:B,2,FALSE))
 
This did it! THANK YOU!!!
D

JE McGimpsey said:
One way:

Assume your matrix of dates and codes are in Sheet2, Cells A1:Bx, with
the dates in column A and codes in column B. Back in Sheet 1, assume the
entry cell is A1, then put this in B1:

=IF(A1<>"",VLOOKUP(A1,Sheet2!A:B,2,FALSE))
 
Back
Top