Can someone help me out on this:
DATA #1
Valuation Settlement Settlement Settlement Accreted Market Market
Dates Date Price Yield Price Yield Price
01/01/98 01/01/98 98.000 6.167% 98.000 6.167% 98.000
01/01/99 01/01/98 98.000 6.167% 98.045 6.401% 95.400
01/01/00 01/01/98 98.000 6.167% 98.092 6.365% 95.900
01/01/01 01/01/98 98.000 6.167% 98.143 6.090% 99.000
01/01/02 01/01/98 98.000 6.167% 98.196 5.764% 102.624
01/01/03 01/01/98 98.000 6.167% 98.253 6.202% 97.900
01/01/04 01/01/98 98.000 6.167% 98.314 5.759% 102.500
01/01/05 01/01/98 98.000 6.167% 98.378 5.899% 101.000

On 01/01/98, the security was purchased @ 98: Settlement price = Accreted
Price = market price = 98.
On 01/01/99, the accreted price = 98.045, which is greater than the Market
price =95.4. So, I will keep using the Accreted Price and still use the
accreted price on 01/01/00 for the same reason.
On 01/01/01, the accreted price = 98.92, which is lower than the Market
Price = 99, and I will switch to use Market price. Considering that I
remarketed the security on 01/01/01, now I have a new set of data on the next
valuation date:

DATA #2
Valuation Settlement Settlement Settlement Accreted Market Market
Dates Date Price Yield Price Yield Price
01/01/01 01/01/01 99.000 6.090% 99.000 6.090% 99.000
01/01/02 01/01/01 99.000 6.090% 99.029 5.764% 102.624
01/01/03 01/01/01 99.000 6.090% 99.060 6.202% 97.900
01/01/04 01/01/01 99.000 6.090% 99.093 5.759% 102.500
01/01/05 01/01/01 99.000 6.090% 99.128 5.899% 101.000

On 01/01/02, now I look at DATA#2 and found that the Market Price = 99.029,
which is higher than the new Accreted Price, so I choose the Market Price.
On 01/01/03, the Accreted Price is higher than the Market price, so I will
use the accreted price, and from 01/01/03 now, I need to create another new
set of DATA#3:

DATA #3
Valuation Settlement Settlement Settlement Accreted Market Market
Dates Date Price Yield Price Yield Price
01/01/03 01/01/03 97.900 6.202% 97.900 6.202% 97.900
01/01/04 01/01/03 97.900 6.202% 97.972 5.759% 102.500
01/01/05 01/01/03 97.900 6.202% 98.050 5.899% 101.000

I have more than 10 securities need to be valuated. I was wondering instead
of keep creating new tables and eyeball every security on every valuation
date, is there a formula or macro can make this easier?? Any help would be
appreciated!