Formulas with Counters

N

Novice

How do I place a formula in a cell while using a counter? Here's an
example of a formula that I want to use:

LEFT(OFFSET($A$27,(ROW($C1)-1)*14,0),LEN(OFFSET($A$27,(ROW($C1)-1)*14,0))-8

In addition, I want to place the same formula in the same column (as an
example Column C). Therefore, Cell $C1 will change to $C2 and so on.
I want to place the original formula in Cell C1 and then C2... I need
to use a counter to tell the program when to stop.

How do I do this? Thanks.
 
T

Tom Ogilvy

counter = 15
Range("C1").Resize(counter,1).Formula = _
"=LEFT(OFFSET($A$27,(ROW($C1)-1)*14,0)," & _
"LEN(OFFSET($A$27,(ROW($C1)-1)*14,0))-8)"
 
D

Darren Hill

Aaaargh! I don't know how often I've created formulas like this, using
something like

Part1 = "= LEFT(OFFSET($A$27,(ROW($C"
Part2 = ")-1)*14,0)," & LEN(OFFSET($A$27,(ROW($C"
Part3 = ")-1)*14,0))-8)"
myFormula = Part1 & counter & Part2 & counter & Part3

and using a loop. <whimper>

That's another technique saved for later :)
--
Darren
Tom Ogilvy said:
counter = 15
Range("C1").Resize(counter,1).Formula = _
"=LEFT(OFFSET($A$27,(ROW($C1)-1)*14,0)," & _
"LEN(OFFSET($A$27,(ROW($C1)-1)*14,0))-8)"

--
Regards,
Tom Ogilvy


Novice said:
How do I place a formula in a cell while using a counter? Here's an
example of a formula that I want to use:
LEFT(OFFSET($A$27,(ROW($C1)-1)*14,0),LEN(OFFSET($A$27,(ROW($C1)-1)*14,0))-8
 
T

Tom Ogilvy

It is usually best to capitalize on Excel's built in capabilities to the
maximum extent possible.

--
Regards,
Tom Ogilvy

Darren Hill said:
Aaaargh! I don't know how often I've created formulas like this, using
something like

Part1 = "= LEFT(OFFSET($A$27,(ROW($C"
Part2 = ")-1)*14,0)," & LEN(OFFSET($A$27,(ROW($C"
Part3 = ")-1)*14,0))-8)"
myFormula = Part1 & counter & Part2 & counter & Part3

and using a loop. <whimper>

That's another technique saved for later :)
--
Darren
Tom Ogilvy said:
counter = 15
Range("C1").Resize(counter,1).Formula = _
"=LEFT(OFFSET($A$27,(ROW($C1)-1)*14,0)," & _
"LEN(OFFSET($A$27,(ROW($C1)-1)*14,0))-8)"
LEFT(OFFSET($A$27,(ROW($C1)-1)*14,0),LEN(OFFSET($A$27,(ROW($C1)-1)*14,0))-8
 
D

Darren Hill

Yes, you just have to know what they are first - that's one of the reasons
I'm here :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top