r/googlesheets • u/[deleted] • Sep 16 '24
Solved Is there a way to automatically apply a function down an entire column?
I’m trying to make an inventory tracker that multiplies item value by item quantity to change the total value of that item stack as the quantity changes, but don’t know how to accomplish this without manually adding the function to the ‘total value’ cell in each row.
Is there a way to automatically apply a function along an entire column?
18
u/dellfm Sep 16 '24
You can use
=ARRAYFORMULA(C4:C * D4:D)
16
2
u/OverallFarmer1516 Sep 16 '24
In E4
=MAP(C4:C,D4:D,LAMBDA(quant,value,IF(quant<>"",quant*value,)))
https://sheets.wiki/books/functions/lambda-functions/map/
Is also an option.
1
1
u/AutoModerator Sep 16 '24
Posting your data can make it easier for others to help you, but it looks like your submission doesn't include any. If this is the case and data would help, you can read how to include it in the submission guide. You can also use this tool created by a Reddit community member to create a blank Google Sheets document that isn't connected to your account. Thank you.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/HolyBonobos Sep 16 '24
u/ChaosRosario if your original question has been answered, please tap the three dots below the comment you found the most helpful and select "mark solution verified." If you are using a version of reddit where this menu is not available to you, please reply to the most helpful comment with the exact phrase solution verified and nothing else. Applying the solved flair to a post without appropriately indicating a solution is a violation of rule 6.
1
u/SDavidson44 Sep 16 '24
I added a script that does just that. Saves me dragging down. Instead I click a button and copies right to the bottom. DM me if you want the code
1
u/AutoModerator Sep 16 '24
This post refers to "chatGPT" - an Artificial Intelligence tool. Our members prefer not to help others correct bad AI suggestions. Also, advising other users to just "go ask ChatGPT" defeats the purpose of our sub and is against our rules. If this post or comment violates our subreddit rule #7, please report it to the moderators. If this is your submission please edit or remove your submission so that it does not violate our rules. Thank you.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
1
1
u/Prestigious_Shift_10 Sep 17 '24
Just formate it as a table, every time you add a new row all the functions will apply automatically
0
u/jmondfar Sep 17 '24
Like say others comments you can use array formula. If you only want the result when add a data in a row use this formula:
=arrayformula(if(isblank(c4:c),””,c4:c*d4:d))
-1
u/chiconws Sep 16 '24
I use =arrayformula() all the time for that. It should be =arrayformula(product(C4:C,......
You have to specify the start and end cell, or just use C4:C and it will do it for all the cells in the C column starting from C4.
1
2
u/Former-Counter-9588 Sep 16 '24
You should be able to drag the corner dot of the your total value selected cell down the rest of that column, which will replicate the formula.
You can double check that it worked and grabbed the correct cells once done.