Cell Value

S

scorpion53061

I am trying to write a formula entered in A1 that says:

=IF(B2 = (contains date),B2,B1)

'contains date' if the cell has a date value in it as opposed to a text
value.

Thank you for your help.
 
B

Bob Phillips

Add this UDF

Function IsADate(rng)
If TypeName(rng) = "Range" Then
If rng.Count > 1 Then
IsADate = CVErr(xlErrRef)
Exit Function
End If
End If
IsADate = IsDate(rng)
End Function


and then use

=IF(ISADate(B2),B2,B1)

--

HTH

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

scorpion53061

perfect.

Thank you much.

Bob Phillips said:
Add this UDF

Function IsADate(rng)
If TypeName(rng) = "Range" Then
If rng.Count > 1 Then
IsADate = CVErr(xlErrRef)
Exit Function
End If
End If
IsADate = IsDate(rng)
End Function


and then use

=IF(ISADate(B2),B2,B1)

--

HTH

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