View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bernard Liengme[_3_] Bernard Liengme[_3_] is offline
external usenet poster
 
Posts: 1,104
Default If then else needed in Excel 2007

A formula cannot change the value in another cell
You could put this into C5: =IF(ISTEXT(C3),-C4,C4)

The code below may help.
Copy it; right click the worksheet tab and select View Code; paste the
subroutine
But it has no way of knowing it the value has been changed previously

Sub Worksheet_change(ByVal Target As Range)
If Target.Address < Range("C3").Address Then Exit Sub
If WorksheetFunction.IsText(Target) Then
Range("c4") = Range("C4") * -1
Else
Range("c4") = Range("C4")
End If
End Sub

best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email


"Legal Learning" wrote in message
...
Ok, here's a reall good one: Here is what I need:

Cell C3 may or may not contain text. If it does, then I want cell C4's
numeric data (which is currently a positive number) to be a negative
number
instead.

Example:

C3=CR
C4=100.00
I want cell C4 to be -100.00 instead of 100.00

Does this make sense?
Any Excel heads out there that can help will be GREATLY appreciated.

CG

Right now I have
--
CLG