ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   set second cell value based on formula in first cell? (https://www.excelbanter.com/excel-programming/346123-set-second-cell-value-based-formula-first-cell.html)

Dingy101

set second cell value based on formula in first cell?
 
How do I set a cell value based on a formula in another cell?


=IF(D4="P.B.A.",G8,0) ,This works to set the value in the cell the formula
is in, say cell A1.

I would like to have this formula reside in cell A1 but set the value in
cell A2 to (G8,0).

Also it would be helpful if I could lock cell A2 based on a False condition
from this formula in cell A1.

Thanks

Gary



[email protected]

set second cell value based on formula in first cell?
 
(G8,0) is not a valid excel formula, but it is a valid string.

Worksheet functions can only return values. The returned value is
displayed in the cell containing the formula. Formulas can not direcly
effect the value of other cells but they can be refered to by those
cells.

In order to give an answer you can use you really need to explain the
problem some more.

/m

http://www.aminaahamed.com


Dingy101

set second cell value based on formula in first cell?
 
I have a cell (A2) that I would like to be forced to .0000 or preferably a
blank display if another cell (D4) does not contain the string P.B.A..

The cell (A2) that I am trying to force to .0000 (or blank) is a cell that
if the cell (D4) does display P.B.A. then the user can input numeric data
into it.

I would Also like to lock cell (A2) to restrict input if cell (D4) does not
display P.B.A.

Cell (A2) could contain the formula if this would permit user input into it
with out affecting the formula. Is there a way to lock or hide the formula?

The data in cell (D4) is selected from a list via data validation. (this
works OK.)

Gary

The data in cell (A2) is used by another cell with an IF statement (this
works OK.)
" wrote:

(G8,0) is not a valid excel formula, but it is a valid string.

Worksheet functions can only return values. The returned value is
displayed in the cell containing the formula. Formulas can not direcly
effect the value of other cells but they can be refered to by those
cells.

In order to give an answer you can use you really need to explain the
problem some more.

/m

http://www.aminaahamed.com



Cush

set second cell value based on formula in first cell?
 
try some thing like:

sub Test1()
Activesheet.Unprotect Password:="ABC"
With Range("A2")
If Range("D4")<"P.B.A." then
.Value = ""
.Locked = True
Else
.Locked = False
End if
End With
Activesheet.Protect Password:="ABC"
End Sub


"dingy101" wrote:

I have a cell (A2) that I would like to be forced to .0000 or preferably a
blank display if another cell (D4) does not contain the string P.B.A..

The cell (A2) that I am trying to force to .0000 (or blank) is a cell that
if the cell (D4) does display P.B.A. then the user can input numeric data
into it.

I would Also like to lock cell (A2) to restrict input if cell (D4) does not
display P.B.A.

Cell (A2) could contain the formula if this would permit user input into it
with out affecting the formula. Is there a way to lock or hide the formula?

The data in cell (D4) is selected from a list via data validation. (this
works OK.)

Gary

The data in cell (A2) is used by another cell with an IF statement (this
works OK.)
" wrote:

(G8,0) is not a valid excel formula, but it is a valid string.

Worksheet functions can only return values. The returned value is
displayed in the cell containing the formula. Formulas can not direcly
effect the value of other cells but they can be refered to by those
cells.

In order to give an answer you can use you really need to explain the
problem some more.

/m

http://www.aminaahamed.com




All times are GMT +1. The time now is 05:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com