John E. McLoughlin
12 May 2005, 10:47 AM
I am hopeful that a member who is familiar with IsNumeric will see this posting and will be able to provide a solution to my problem for which I would be most grateful.
For reasons that I will not labour, I have transferred my focus from Generations to Reunion. To that end, I now have a Mac Mini, Reunion and Office 2004 for Mac, as well as my Windows PC. Incidentally, it is pertinent that Excel 2004 for Mac is said to be compatible with Excel 2003 for Windows.
For some time now, I have transcribed pertinent entries from census pages into Excel spreadsheets and, to calculate the estimated year of birth, I wrote a procedure function. In certain UK Censuses, the ages of men and women are recorded in separate columns and the ages of infants less than one year are given in months (7 m), weeks (3 w) or days (5 d). With this in mind, the following code depicts the area of my function that is problematic:
Function yob71(m_age, f_age) ***************** ‘Year of Birth – UK 1871 Census
If IsNumeric(m_age) = True And m_age > 0 Then
*** yob71 = 1871 - m_age – 1 ***************** ‘Where m_age is age of male
ElseIf IsNumeric(f_age) = True And f_age > 0 Then
*** yob71 = 1871 - f_age – 1 ****************** ‘Where f_age is age of female
ElseIf IsNumeric(m_age) = False Then *********** ‘Where m-age < 1 (9 m, 6 d or the like
*** yob71 = "Baby Boy" *********************** ‘Baby Boy represents a Select Case procedure
ElseIf IsNumeric(f_age) = False Then************* ‘Where m-age < 1 (9 m, 6 d or the like
*** yob71 = "Baby Girl" *********************** ‘Baby Girl represents a Select Case procedure
Else: yob71 = ""
End If
End Function
Whilst this function works on my PC under Windows it fails on my Mac Mini. The problem seems to lie with the fact that, in Excel 2004 for Mac, a non-numeric variable passed to IsNumeric generates a vbError (10), which is manifest by a #Value error and an explanation that “A value used in the formula is of the wrong data type”.
I thought, perhaps, a solution might be found through the CVErr function but I cannot see a way of harnessing it to that end.
For reasons that I will not labour, I have transferred my focus from Generations to Reunion. To that end, I now have a Mac Mini, Reunion and Office 2004 for Mac, as well as my Windows PC. Incidentally, it is pertinent that Excel 2004 for Mac is said to be compatible with Excel 2003 for Windows.
For some time now, I have transcribed pertinent entries from census pages into Excel spreadsheets and, to calculate the estimated year of birth, I wrote a procedure function. In certain UK Censuses, the ages of men and women are recorded in separate columns and the ages of infants less than one year are given in months (7 m), weeks (3 w) or days (5 d). With this in mind, the following code depicts the area of my function that is problematic:
Function yob71(m_age, f_age) ***************** ‘Year of Birth – UK 1871 Census
If IsNumeric(m_age) = True And m_age > 0 Then
*** yob71 = 1871 - m_age – 1 ***************** ‘Where m_age is age of male
ElseIf IsNumeric(f_age) = True And f_age > 0 Then
*** yob71 = 1871 - f_age – 1 ****************** ‘Where f_age is age of female
ElseIf IsNumeric(m_age) = False Then *********** ‘Where m-age < 1 (9 m, 6 d or the like
*** yob71 = "Baby Boy" *********************** ‘Baby Boy represents a Select Case procedure
ElseIf IsNumeric(f_age) = False Then************* ‘Where m-age < 1 (9 m, 6 d or the like
*** yob71 = "Baby Girl" *********************** ‘Baby Girl represents a Select Case procedure
Else: yob71 = ""
End If
End Function
Whilst this function works on my PC under Windows it fails on my Mac Mini. The problem seems to lie with the fact that, in Excel 2004 for Mac, a non-numeric variable passed to IsNumeric generates a vbError (10), which is manifest by a #Value error and an explanation that “A value used in the formula is of the wrong data type”.
I thought, perhaps, a solution might be found through the CVErr function but I cannot see a way of harnessing it to that end.