Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9782

Perform different operations depending on cell content in Google Sheets

$
0
0

I have a sheet where I would like to calculate the total weight of an object after a number of operations have been performed on it, either adding or multiplying the weight. Any of the modifications could either be addition or multiplication and in any order. For example.

6+2x2=10

6x3+1=19

I managed to find an ineligant solution for 1 operation, which was to format multiples as text and then the following formula =IF(ISTEXT(B1)=TRUE,A1*B1,A1+B1) where A1 is the original number and B1 is the operation.

However, this does not scale up without doing ifs for all combinations.

I can get a cell to produce the formula I want as text with this formula ="="&A1&B1&C1where I write either '+2 or '*2 depending on the operation, but I don't know if I can take this and then coerce that into a solved equation.

Any help with this would be massively appreciated, thank you.

EDIT: Below is a link to a mockup of what I am hoping to achieve. The "Combined Objects (ideal outcome)" table shows what I would like the table to do, which is enter in one of the objects and a number of modifications from the tables on the right is produce the solution to the equation.

in "Combined Objects" the Weight collums show how I can produce the equation I am hoping to solve, but I don't know how to get any further. I hope this makes it clearer.

https://docs.google.com/spreadsheets/d/1RybNokK8Gk3ofNm49bCJgRZDGWRnmooMYtgCZULPubg/edit?usp=sharing


Viewing all articles
Browse latest Browse all 9782

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>