# Check Value of a Fraction in Table CL

**URL:** <https://cl.desmos.com/t/check-value-of-a-fraction-in-table-cl/1564>\
**Category:** Questions\
**Created:** [September 24, 2020, 10:02am UTC](https://cl.desmos.com/t/check-value-of-a-fraction-in-table-cl/1564 "2020-09-24T10:02:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jme](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/jme/32/516_2.png) [@Jme](https://cl.desmos.com/u/Jme)\
**Post date:** [September 24, 2020, 10:02am UTC](https://cl.desmos.com/t/check-value-of-a-fraction-in-table-cl/1564/1 "2020-09-24T10:02:18Z")

</div>

I’m trying to get my table to check the value of a fraction in a table. Students could input, 1/2 or any other equivalent fraction. I’ve combed cl.desmos but haven’t found the solution.  
I started with this, but it only checks for the input of the decimal, not the value of the decimal. Any suggestions?

```auto
this=table1
isCorrect1 = this.cellNumericValue(1,2)= 0.5
```

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [September 24, 2020, 4:40pm UTC](https://cl.desmos.com/t/check-value-of-a-fraction-in-table-cl/1564/2 "2020-09-24T16:40:45Z")

</div>

So, to clarify you want students to enter a fraction equivalent to 1/2, but not accept the decimal answer. I would do this:

`isCorrect1= this.cellNumericValue(1,2)= 0.5 and countNumberUsage(this.cellContent(1,2), 0.5)= 0`

(Edited: removed .latex to fix it)

---

<div class="post-metadata">

**Author:** ![Jme](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/jme/32/516_2.png) [@Jme](https://cl.desmos.com/u/Jme)\
**Post date:** [September 26, 2020, 9:05am UTC](https://cl.desmos.com/t/check-value-of-a-fraction-in-table-cl/1564/3 "2020-09-26T09:05:26Z")

</div>

That didn’t quite work.  
I found this to work to check for the fraction:

```auto
isCorrect1 = when this.cellNumericValue(1,2)=0.5 or this.cellNumericValue(1,2)=50 

```

But when I tried using `countNumberUsage(this.cellContent(1,2).latex, 0.5)= 0`  
it came up with the warning:

 ![Screen Shot 2020-09-26 at 4.48.37 AM](https://canada1.discourse-cdn.com/flex031/uploads/desmos/original/2X/1/10c5de648682b01c87657c5eaa1109a2ebf704d5.png)

I would like to add the code to not accept the decimal form though.

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [September 26, 2020, 4:39pm UTC](https://cl.desmos.com/t/check-value-of-a-fraction-in-table-cl/1564/4 "2020-09-26T16:39:34Z")

</div>

I took out the “.latex” and it seems to work fine. Your top level declaration error is because you have `when` but no `otherwise` I think.

---

<div class="post-metadata">

**Author:** ![Jme](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/jme/32/516_2.png) [@Jme](https://cl.desmos.com/u/Jme)\
**Post date:** [September 27, 2020, 10:00am UTC](https://cl.desmos.com/t/check-value-of-a-fraction-in-table-cl/1564/5 "2020-09-27T10:00:23Z")

</div>

> [@Daniel\_Grubbs](#):
>
> countNumberUsage(this.cellContent(1,2).latex, 0.5)= 0

That works for me now too.  
I originally didn’t have the end of it:

```auto
row1a= when this.cellNumericValue(1,2)=0.5 and countNumberUsage(this.cellContent(1,2), 0.5)= 0 1 otherwise 0

Thanks for the help on that!
```
