# Calculate and change background based on row data

**URL:** <https://community.weweb.io/t/calculate-and-change-background-based-on-row-data/15229>\
**Category:** How do I?\
**Created:** [January 4, 2025, 3:40pm UTC](https://community.weweb.io/t/calculate-and-change-background-based-on-row-data/15229 "2025-01-04T15:40:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emil](https://avatars.discourse-cdn.com/v4/letter/e/f4b2a3/32.png) [@Emil](https://community.weweb.io/u/Emil)\
**Post date:** [January 4, 2025, 3:40pm UTC](https://community.weweb.io/t/calculate-and-change-background-based-on-row-data/15229/1 "2025-01-04T15:40:18Z")

</div>

Hi, I want to create a calculation per row and use this to change the background color of a cell in the data grid. I know the examples are wrong (I found they don’t work 🙂 ), but how do I access the data for each row?

 ![CleanShot 2025-01-04 at 16.23.28@2x](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/0/06ee430a93d6772b003d8ec7f6dc01e487273f65.png)  
 ![CleanShot 2025-01-04 at 16.23.52@2x](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/3/3093b0c778be1c14cedb14da1d879245592877d1.png)

---

<div class="post-metadata">

**Author:** ![Broberto](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/broberto/32/5918_2.png) [@Broberto](https://community.weweb.io/u/Broberto)\
**Post date:** [January 4, 2025, 8:10pm UTC](https://community.weweb.io/t/calculate-and-change-background-based-on-row-data/15229/2 "2025-01-04T20:10:58Z")

</div>

If you post the logic in a readable format and the data, we might be able to help
