Thread: Newbie IF
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
JeffP[_2_] JeffP[_2_] is offline
external usenet poster
 
Posts: 1
Default Newbie IF

Very nice and very clean. I never thought of IIf (why
would I?)and I don't really understand the second
statement. Still, I had to add .text property to the Range
property. .Value property returns false also.
Range("d242")= If(Range("d237").text = Range
("d239").text,"1","2")
Why, I don't know ... but I did some testing by entering a
dummy cell w/ a number and using it against first d237 and
then d239. The cell d237 is a formula (=D234-d235) and is
recognized as a number by .value or just plain Range.
However, the cell in D239, which is a reference to a cell
on another sheet has some kind of Text status, I guess.
The reference is ='Import Page'!C216 and this cell is a
formula (=c35-c45). Originally,c45 and c35 were imported
as text but I multiplied by 1 and used Paste Special
because of the problem w/ negative numbers being read as
text and therefore invisible to formulas.
Anyway......this is where I am and any education is
appreciated.
jeffP

-----Original Message-----
It's VBA Jeff

Range("D241") = IIf(Range("D237") = Range

("D239"), "1", "2")

or

Range("D241") = (Range("D237") = Range("D239")) * 1 +

2

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"JeffP " wrote in

message
...
It seemed like a simple fix,but it still doesn't work.
BTW, a simple If Function does work but I'm trying to

learn VB.

This function returns a "1"

=IF(D239=D237,"1","2")

Still wonderin'
jeff


---
Message posted from http://www.ExcelForum.com/



.