Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculating difference - date vs numeric

Status
Not open for further replies.
Jun 11, 2008
34
US
I have a text field called corebirthyr. I want to subtract it from year(currentdate) which is a numeric.
I converted the corebirthyr to numeric tonumber({corebirthyr}). I then created a formula subtracting corebirthyr from year(currentdate) with the purpose of getting the numeric age.

I keep getting an error message saying that the tonumber(corebirthyr) is a string. If I used the tonumber function that should not be the case. Is there another way to compare the 2 fields to get the age. I do not think I can use datediff function in this case since we are comparing 2 different data types??
 
Probably have non numeric text in {corebirthyr}).

Do a test first

If isnummeric(tonumber({corebirthyr})) = true then tonumber({corebirthyr}) else 0

This will throw up massive ages for faulty data.

Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top