View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Gerry Timber Gerry Timber is offline
external usenet poster
 
Posts: 2
Default Enter value in compute cell location?

On Tuesday, January 16, 2018 at 11:27:10 PM UTC+1, dpb wrote:
Is it possible to have the result of an expression generate the address
into which to enter a value? Example would be given a State variable of
one of (say) three values, place another cell value in one of three
columns dependent upon the state. It's simple enough to duplicate a
lookup function in every cell of all three columns, but that seems
excessive.

GIVEN

A B C D E F
1 10 'A
2 5 'C
3 20 'A
4 2 'B
.
.
.


WANTED

A B C D E F
1 10 'A ? 10
2 5 'C ? 5
3 20 'A ? 20
4 2 'B ? 2
.
.
.

A formula in column C using B and a lookup can create D thru F (the "?")
would be...

--


@GS
Yes, thank you for the type LONG adjustment

@dpb

As to the rowcount, it is the same during each step in the For Next loop.
It is increased with 1 every step in the For Next loop, as it goes through.

This enables the 3 If Then constructs where rowcount to maintain same value.

The - (substraction) which takes place to copy value "amt" and the + (addition) to place this copied "amt" in the subsequent column donot have effect on the variable values.
Anyhow, thank you.