# How to add quantity without create new row on spreadsheet

**URL:** <https://community.thunkable.com/t/how-to-add-quantity-without-create-new-row-on-spreadsheet/2835533>\
**Category:** Questions about Thunkable X\
**Tags:** beginner\
**Created:** [February 15, 2024, 2:59pm UTC](https://community.thunkable.com/t/how-to-add-quantity-without-create-new-row-on-spreadsheet/2835533 "2024-02-15T14:59:39Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![samyt3475q](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@samyt3475q](https://community.thunkable.com/u/samyt3475q)\
**Post date:** [February 15, 2024, 2:59pm UTC](https://community.thunkable.com/t/how-to-add-quantity-without-create-new-row-on-spreadsheet/2835533/1 "2024-02-15T14:59:39Z")

</div>

so i am trying to create a scanner like what every store have, so when i scan a barcode the series number is added to the spreadsheet row, but i don’t want to every time i scan, it creates a new row, rather i just want to add the quantity, what model of blocks should i build? thank you

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [February 15, 2024, 3:18pm UTC](https://community.thunkable.com/t/how-to-add-quantity-without-create-new-row-on-spreadsheet/2835533/2 "2024-02-15T15:18:20Z")

</div>

What you’re describing is a vlookup where you search one column for a value (barcode) and then update a different column’s value (quantity) in the same row.

Search the forums for _vlookup_ and you’ll find examples of this.

---

<div class="post-metadata">

**Author:** ![samyt3475q](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@samyt3475q](https://community.thunkable.com/u/samyt3475q)\
**Post date:** [February 15, 2024, 3:21pm UTC](https://community.thunkable.com/t/how-to-add-quantity-without-create-new-row-on-spreadsheet/2835533/3 "2024-02-15T15:21:19Z")

</div>

alright, hang on

---

<div class="post-metadata">

**Author:** ![samyt3475q](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@samyt3475q](https://community.thunkable.com/u/samyt3475q)\
**Post date:** [February 18, 2024, 12:26pm UTC](https://community.thunkable.com/t/how-to-add-quantity-without-create-new-row-on-spreadsheet/2835533/4 "2024-02-18T12:26:07Z")

</div>

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/b/eb99562f82a063040e77f61625bc1f76fe98180c.png)  
So, sir, somehow i am able to reach this block structure, it successfully avoid multiple data by giving it an if condition, but i still unable to add quantity on every data i added, do you why? thank you

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [February 18, 2024, 1:56pm UTC](https://community.thunkable.com/t/how-to-add-quantity-without-create-new-row-on-spreadsheet/2835533/5 "2024-02-18T13:56:54Z")

</div>

Thunkable evaluates each block or block combination for a value. So when you have the blocks x=x+1 where x is a variable, that evaluates to false because each side of that equation has a different value.

I know you were trying to increase the value of the variable by 1 in the screenshot below but that’s not what the equals block does in Thunkable. It compares two values and returns true or false. So your blocks are attempting to store the value false in the data source.

To fix that, remove the = block and just store the value of your variable plus one (x+1).

 ![IMG_1338](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/9/3911003be5e8c9576b4fe9dd23446a65fef7cc9c.jpeg)

---

<div class="post-metadata">

**Author:** ![samyt3475q](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@samyt3475q](https://community.thunkable.com/u/samyt3475q)\
**Post date:** [February 18, 2024, 2:45pm UTC](https://community.thunkable.com/t/how-to-add-quantity-without-create-new-row-on-spreadsheet/2835533/6 "2024-02-18T14:45:27Z")

</div>

![WhatsApp Image 2024-02-18 at 9.44.23 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/2/b241047930071f9e72177f464e76ab55bcf55b5f.jpeg)  
well, we got something but it’s not number, but NaN, what is NaN?

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [February 18, 2024, 4:37pm UTC](https://community.thunkable.com/t/how-to-add-quantity-without-create-new-row-on-spreadsheet/2835533/7 "2024-02-18T16:37:56Z")

</div>

> **[NaN](https://en.wikipedia.org/wiki/NaN)**
>
> In computing, NaN (/næn/), standing for Not a Number, is a particular value of a numeric data type (often a floating-point number) which is undefined as a number, such as the result of 0/0. Systematic use of NaNs was introduced by the IEEE 754 floating-point standard in 1985, along with the representation of other non-finite quantities such as infinities.
> In mathematics, 0/0 is typically not defined as a number\[a\] and is therefore represented by NaN in computing systems.
> The square root of a n...

How are you setting the value of app variable quantity? And how are you initializing that variable?

Feel free to post a link to your project if it’s easier than posting more screenshots.

---

<div class="post-metadata">

**Author:** ![samyt3475q](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@samyt3475q](https://community.thunkable.com/u/samyt3475q)\
**Post date:** [February 19, 2024, 12:54pm UTC](https://community.thunkable.com/t/how-to-add-quantity-without-create-new-row-on-spreadsheet/2835533/8 "2024-02-19T12:54:37Z")

</div>

[https://x.thunkable.com/copy/5f3fb1ba8fe2df06c5182205176d0fec](https://x.thunkable.com/copy/5f3fb1ba8fe2df06c5182205176d0fec)

here, can it be opened?

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [February 19, 2024, 4:26pm UTC](https://community.thunkable.com/t/how-to-add-quantity-without-create-new-row-on-spreadsheet/2835533/9 "2024-02-19T16:26:44Z")

</div>

Yes, I was able to open it. You are initializing app variables quantity as a list and then trying to use it as a number.

This is called mixing variable types and should be avoided.

Delete the list of values block from the initialize block for that variable. You do not have to give an app variable an initial value but if you want to, you can set it to zero.

You also need to set the value of app variable in the click event block to the current value of the data source cell that you want to update. That way, when you add one to it later, it provides the correct value.

---

<div class="post-metadata">

**Author:** ![samyt3475q](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@samyt3475q](https://community.thunkable.com/u/samyt3475q)\
**Post date:** [February 20, 2024, 2:18pm UTC](https://community.thunkable.com/t/how-to-add-quantity-without-create-new-row-on-spreadsheet/2835533/10 "2024-02-20T14:18:05Z")

</div>

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/3/43fd272be3b2d59773d4478099ac3d62a274df84.png)  
you mean like this sir? i still get NaN for the quantity

---

<div class="post-metadata">

**Author:** ![samyt3475q](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@samyt3475q](https://community.thunkable.com/u/samyt3475q)\
**Post date:** [February 24, 2024, 4:03pm UTC](https://community.thunkable.com/t/how-to-add-quantity-without-create-new-row-on-spreadsheet/2835533/11 "2024-02-24T16:03:03Z")

</div>

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/a/aa6f8fb916c0cac292a78c715c358efec91c2d27.png)  
hi sir, i successfully avoid Nan on multiple scan, but the quantity still unable to increase, is there any kind of blocks rule to get the increment process? thank you

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [February 24, 2024, 6:57pm UTC](https://community.thunkable.com/t/how-to-add-quantity-without-create-new-row-on-spreadsheet/2835533/12 "2024-02-24T18:57:06Z")

</div>

You’re not setting the value of app variable quantity anywhere else except when initializing it. Before you save app variable quantity + 1, you need to increase the variable’s value by 1 and then save the value of the variable to the data source. Sorry, I’m on my phone so I can’t post a screenshot of the blocks you need.

---

<div class="post-metadata">

**Author:** ![tthompson41231](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tthompson41231/32/161401_2.png) [@tthompson41231](https://community.thunkable.com/u/tthompson41231)\
**Post date:** [February 25, 2024, 1:52pm UTC](https://community.thunkable.com/t/how-to-add-quantity-without-create-new-row-on-spreadsheet/2835533/13 "2024-02-25T13:52:20Z")

</div>

![Screenshot 2024-02-25 085058](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/b/fb189dfe1782ca38756a0a2fe505c358dc9e85a1.png)

---

<div class="post-metadata">

**Author:** ![samyt3475q](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@samyt3475q](https://community.thunkable.com/u/samyt3475q)\
**Post date:** [February 25, 2024, 3:23pm UTC](https://community.thunkable.com/t/how-to-add-quantity-without-create-new-row-on-spreadsheet/2835533/14 "2024-02-25T15:23:39Z")

</div>

i tried, but it is stuck in 2, no more increments after multiple scan process

---

<div class="post-metadata">

**Author:** ![tthompson41231](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tthompson41231/32/161401_2.png) [@tthompson41231](https://community.thunkable.com/u/tthompson41231)\
**Post date:** [February 25, 2024, 5:46pm UTC](https://community.thunkable.com/t/how-to-add-quantity-without-create-new-row-on-spreadsheet/2835533/15 "2024-02-25T17:46:46Z")

</div>

This is not a valid number.

![Screenshot 2024-02-25 124548](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/6/a635fa6ed9c5d0153f6648b869d6e3a9f502d0e1.png)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [February 25, 2024, 11:30pm UTC](https://community.thunkable.com/t/how-to-add-quantity-without-create-new-row-on-spreadsheet/2835533/16 "2024-02-25T23:30:44Z")

</div>

It might be, depending on the country.

---

<div class="post-metadata">

**Author:** ![tthompson41231](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tthompson41231/32/161401_2.png) [@tthompson41231](https://community.thunkable.com/u/tthompson41231)\
**Post date:** [February 26, 2024, 2:04am UTC](https://community.thunkable.com/t/how-to-add-quantity-without-create-new-row-on-spreadsheet/2835533/17 "2024-02-26T02:04:21Z")

</div>

@tatiang Interesting, I never knew that. That might be his problem though. Thunkable might see that as a string.

---

<div class="post-metadata">

**Author:** ![samyt3475q](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@samyt3475q](https://community.thunkable.com/u/samyt3475q)\
**Post date:** [February 26, 2024, 6:14am UTC](https://community.thunkable.com/t/how-to-add-quantity-without-create-new-row-on-spreadsheet/2835533/18 "2024-02-26T06:14:51Z")

</div>

is it because you set it on list? so it returned on list

---

<div class="post-metadata">

**Author:** ![tthompson41231](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tthompson41231/32/161401_2.png) [@tthompson41231](https://community.thunkable.com/u/tthompson41231)\
**Post date:** [February 26, 2024, 12:56pm UTC](https://community.thunkable.com/t/how-to-add-quantity-without-create-new-row-on-spreadsheet/2835533/19 "2024-02-26T12:56:47Z")

</div>

Try this. In this version of your app, when the screen opens it sets a variable to a list of all the products on your google sheet. When you scan a new product, it will save it to your google sheet and also the local list variable. This will help speed up the scanning process as well.

Edit: You can remove text component I added. It was used for testing purposes.

[https://x.thunkable.com/copy/f68d7419fd5f1bc5610b9302f45aac73](https://x.thunkable.com/copy/f68d7419fd5f1bc5610b9302f45aac73)

---

<div class="post-metadata">

**Author:** ![samyt3475q](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@samyt3475q](https://community.thunkable.com/u/samyt3475q)\
**Post date:** [February 27, 2024, 1:55pm UTC](https://community.thunkable.com/t/how-to-add-quantity-without-create-new-row-on-spreadsheet/2835533/20 "2024-02-27T13:55:59Z")

</div>

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/5/95a6344231b8eb4574d683eb0e97cc74720d126e.png)  
still stuck on 2,00 on spreadsheet sir, i do not know why, but im still trying to figure it out

[Next page](https://community.thunkable.com/t/how-to-add-quantity-without-create-new-row-on-spreadsheet/2835533.md?page=2)
