ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cell Value (https://www.excelbanter.com/excel-programming/297000-cell-value.html)

scorpion53061[_2_]

Cell Value
 
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.



Bob Phillips[_6_]

Cell Value
 
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)

"scorpion53061" wrote in message
...
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.





scorpion53061[_2_]

Cell Value
 
perfect.

Thank you much.

"Bob Phillips" wrote in message
...
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)

"scorpion53061" wrote in message
...
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.








All times are GMT +1. The time now is 10:04 AM.

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