# Check for mixed number in Table

I’m needing to check if the value entered in a table cell is a mixed number.
The correct answer I’m looking for is 2 ⅓
Here’s what I have so far:

row1a=table.cellNumericValue(1,1)
correct:numericValue("\abs(${row1a}-(7/3))")<=0.001 cellDisableEvaluation(1,1): true  *I found the following to work in a math input, but it won’t in a table. checkMixed = countNumberUsage(answer.latex,2)=2 and countNumberUsage(answer.latex,)=1 and countNumberUsage(answer.latex,3)=1  Any help would be appreciated. Since row1a is a numericValue, you might need to put backticks for it to work. Or since it’s numericValue, it might be a decimal in that form, unlike cellContent. ...countNumberUsage(row1a,2)=2...  Actually, displaying a numericValue as a string will always be a single number. e.g. cell content is : 1/2+5 row1a = 5.5 ${row1a} = 5.5

If you want to use what the student typed, use cellContent

1 Like

I’ve tried it both ways, but unfortunately I can’t get either to work. Other suggestions?

row1a=table.cellNumericValue(1,1)
correct1a=numericValue("\abs(${row1a}-(7/3))")<=0.001 #checks for mixed number of 2 1/3 Mixed1a=table.cellContent(1,1)="1/3+2" mixed1a=countNumberUsage(row1a,2)=1 and countNumberUsage(row1a,1)=1 and countNumberUsage(row1a,3)=1  Here’s the screen: countNumberUsage needs latex input (i.e. table.cellContent(1,1)). You’re still using row1a which is equivalent to the cellNumericValue, which is a decimal. It should work if you do this: row1a=table.cellContent(1,1)  If a student puts in 2 1/3 table.cellNumericValue(1,1) = 2.3333333...  but table.cellContent(1,1)= 2\frac{1}{3}  Got it! Thanks for y’all’s help! I changed the row1a to cellContent, but also needed to remove the row1a in the countNumberUsage row1a=table.cellContent(1,1) correct1a=numericValue("\abs(${row1a}-(7/3))")<=0.001

mixed1a=countNumberUsage(table.cellContent(1,1),2)=1 and countNumberUsage(table.cellContent(1,1),1)=1 and countNumberUsage(table.cellContent(1,1),3)=1

After changing row1a, you didn’t need to remove it from countNumberUsage, since it’s now cellContent.