Monday, May 26, 2008

HP-calculator equation, financial investment

This equation is for quick calculation of buying/selling stocks.

IF(S(AMT) OR S(VOL): AMT-VOL*PRICE :
(VOL*PRICE-ABS(VOL*PRICE*COM%/100*(1+VAT%/100)))-TOTAL)


Input negative value either AMT or VOL to indicate buying.
Note that I use '*' and '/' for multiply and divide operators respectively (the calculator uses exact arithmatic symbols).

I should add more from HP 200LX later.

Cheers,
[vps]

Sunday, May 25, 2008

LotusNotes: asset aging formula

This formula calcaluates age from field 'Purchase_date' and rounds to 0.5-year interval.

y0 := @Today;
y1 := @Year(y0) +(@Month(y0)/12);
x0 := @If(Purchase_date=""; y0; @TextToTime(Purchase_date));
x1 := @Year(x0) +(@Month(x0)/12);
@If(Purchase_date=""; -1; @Round(y1 - x1 -0.24; 0.5))


Actually the formula of y1 (and x1) would be "... +((@month(y0) -1) /12)". However, when (y1 - x1) is computed, result will be correct value.

Offset value 0.24 is used to implement "round down" or "floor" function. It is 0.24 instead of 0.25 in order to avoid case when the item has just been purchased (where result will be calculated to -0.25 and then rounded down to -0.5). If quarterly-basis is preferred, @round's arguments become (y1 - x1 -0.124; 0.25).

In this context, the field Purchase_date is text type. Formula returns -1 when Purchase_date has no value.