View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
MickinOz MickinOz is offline
external usenet poster
 
Posts: 2
Default copy a value across a row but into every nth cell

Thanks Joel,
That is useful but not quite what I want (being lazy I don't want to fill in
100's of cells manually).

I came up with a kludge:
F G H I J
Cost Freq Start End Incr
1,100 A 1 29 5%

Row 2 cell K2 is an integer representing the month (1,2,3, etc.)

Freq can be A (annual) Q (quarterly) or M (monthly, max 36).

The value in J is an allowance for cost increase.

And the formula in K3 and each cell rightwards from there is:
=IF(K$2$I4,0,IF(AND($G4="a",OR(K$2=$H4,K$2=$H4+12 ,K$2=$H4+24)),$F4*(1+($J4/12))^K$2,IF(AND($G4="q",OR(K$2=$H4,K$2=$H4+3,K$2=$ H4+6,K$2=$H4+9,K$2=$H4+12,K$2=$H4+15,K$2=$H4+18,K$ 2=$H4+21,K$2=$H4+24,K$2=$H4+27,K$2=$H4+30,K$2=$H4+ 33,K$2=$H4+36)),$F4*(1+($J4/12))^K$2,IF(AND($G4="m",K$2=$H4),$F4*(1+($J4/12))^K$2,0))))

Messy, but it works.
If you can reproduce it maybe you can tell me how to simplify it.

Thanks again
Mike

Joel" wrote:

The best way is to setup some shortcut keys to move around the worksheet.

Sub copyright()

ActiveCell.Copy
ActiveCell.Offset(rowoffset:=0,columnofffset:= 12).Activate
End Sub

The above macro copies the activecell and then moves right 12 cells. You
can assign the macro a shortcut key by going on worksheet to Tools Menu Macro
- Options. Then enter a letter in the shortcut box.

The macro above could be modified to also do the paste.

You should also learn other standard shortcut keys available by searching in
the Worksheet help for "Shortcut". For example Cntl right arrow gets you to
the first column.

"MickinOz" wrote:

Say I have a table that has a variable (say$50) in cell 1 and is 12 months
wide (i.e. 13 cells across) I want to copy the variable into every nth cell
(where n is also a variable)
In this way I can say that certain expenses occur every n months.
Any suggestions greatly appreciated.
Mike