IF Function

R

Ranjit kurian

Hi
i have a doubt on IF function, i have two columns Name and DEPT, if we have
A in column Name then the Dept will be Apple, and if allready name is filled
in DEPT column (example 'Bun')then the IF function should not change any
thing it should be as it is.

Example:

Name DEPT
A =IF(A2="A","APPLE",?)
A =IF(A3="A","APPLE",?)
B BUN
 
B

Bob Phillips

You can't do that with a formula, the cell either has a value or a formula,
it cannot have both. Either use another column or use VBA.
 
D

Don Guillett

Right click sheet tab>view code>insert this

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Columns(1)) Is Nothing Then Exit Sub
If Len(Application.Trim(Target.Offset(, 1))) > 0 Then Exit Sub
If UCase(Target) = "A" Then Target.Offset(, 1) = "Apple"
End Sub
 
Top