Possible in one formula in google sheets? - if-statement

I'm new to formulas in google sheets but doing ok with online learning.
I have come across something I need to do that I cant find a solution for.
I have this that works:
=if(O13>=Q14,O13-INFO!L5*O13,0)
But now I need to also include a cap to the returned value so if it reaches a certain number it will stop and return no more than a value found in another cell (in this case it would be "INFO!M5").
Is this possible within the same formula and if this type of thing has a certain name for phrase I don't know, is that why I cant find help on it.
Thanks
Adam

try nested-if:
=IF(O13>=Q14, IF((O13-INFO!L5*O13)<=INFO!M5, O13-INFO!L5*O13, INFO!M5), 0)
update:
=IF((G7>=0)*(G7<=I7), G7-G7*K7, M7 )

Related

Google sheets - How to compare a formula within a cell with a string to spot changes in the formula?

I help a small business with an application which is entirely run from google sheets and google forms. The issue is that from time to time the business owner will go into the sheet and delete rows of old data. I've noticed that as a result, some of the formulas will change the row which they are looking at. This is despite me using explicit cell references such as $A$1 for example.
So what I would like to do, is use somehow compare the cell which contains the formula, with a string of what the formula should be, then return a value if the formula matches. I had thought an =If function would solve this but so far I am not having any luck.
This is what I have used so far:
Lets say cell A1 contains the formula I want to check and the formula is (this works fine): =FILTER(Dashboard!A2:A, Dashboard!C2:C1 = TODAY())*
I am using =IF(A1="=FILTER(Dashboard!A2:A, Dashboard!C2:C*1 = TODAY())",True,False)
I am expecting the function to compare the value of A1 with my string and return the value True. If the formula does not match the string it should return the value False.
I currently am returning the value of False despite the formula and string being an exact match. I assume this is because my =If statement is looking at the value returned by the =Filter function rather than the formula itself.
Any help would be appreciated.
thanks
You could just use INDIRECT() in the place of explicit cell ($A$1) reference you mentioned and that should solve the problem of formulas going haywire due to rows deletion in Form Responses tab. Please do test it out.
INDIRECT("Sheet!"&A1)
INDIRECT("A1")

Extract list from range Google Sheets

I have some data from workplaces with some different work areas, I need to extract a list for each workplace with their corresponding availables working areas, I have an example of some kind of attempt really close what I wanted. I use this formula but with more data will be long time to do it =IF(D2=$G$1, "Yes", "No"). I want to do it more automatic with some formulas but I don't know where to start.
Give a try on below formula. Put the formula to G1 cell then drag down as needed.
=TRANSPOSE(IFERROR(FILTER($D$2:$D$16,$A$2:$A$16=F2,$D$2:$D$16<>""),""))

Is it possible to exclude values when creating SUM in google sheets?

I have a profit sheet I use, and in my profits column I would like to create a SUM of the whole column whilst excluding the numbers which are negative. Anyone have any ideas of how to do this? It's a long column and manually excluding the numbers one by one would take time. The negative numbers are marked by - if that helps.
I'd imagine it needs an IF statement but i'm not too sure.
Any help would be appreciated, thanks!
I think there may several way to do that. One simplest way is to use SUMIF() function. Try-
=SUMIF(A:A,">0",A:A)

Having issues with Google Sheets formula combing ArrayFormula with IF

This works the way I want it to but I want to use the ArrayFormula to add the formula to the whole column starting at Cell J2:
=IF(E2:E="Closed","",MINUS(TODAY(),I2))
This doesn't work:
=ARRAYFORMULA(IF(E2:E="Closed","",,J2:J), MINUS(TODAY(),I2))
I have tried multiple ways to add the ArrayFormula into it and reorganized it multiple ways but it failed.
Any ideas where I am going wrong?
Any help appreciated!
Please use the following formula
=ArrayFormula(IF(I2:I<>"", IF(E2:E="Closed","CL",MINUS(TODAY(),I2:I)),""))
(where today is May 20th. Adjust ranges and notifications to your liking)

What are hp.Discrete and hp.Realinterval? Can I include more values in hp.realinterval instead of just 2?

I am using Hyperparameter using HParams Dashboard in Tensorflow 2.0-beta0 as suggested here https://www.tensorflow.org/tensorboard/r2/hyperparameter_tuning_with_hparams
I am confused in step 1, I could not find any better explanation. My questions are related to following lines:
HP_NUM_UNITS = hp.HParam('num_units', hp.Discrete([16, 32]))
HP_DROPOUT = hp.HParam('dropout', hp.RealInterval(0.1, 0.2))
HP_OPTIMIZER = hp.HParam('optimizer', hp.Discrete(['adam', 'sgd']))
My question:
I want to try more dropout values instead of just two (0.1 and 0.2). If I write more values in it then it throws an error- 'maximum 2 arguments can be given'. I tried to look for documentation but could not find anything like from where these hp.Discrete and hp.RealInterval functions came.
Any help would be appreciated. Thank you!
Good question. They notebook tutorial lacks in many aspects. At any rate, here is how you do it at a certain resolution res
for dropout_rate in tf.linspace(
HP_DROPOUT.domain.min_value,
HP_DROPOUT.domain.max_value,
res,):
By looking at the implementation to me it really doesn't seem to be GridSearch but MonteCarlo/Random search (note: this is not 100% correct, please see my edit below)
So on every iteration a random float of that real interval is chosen
If you want GridSearch behavior just use "Discrete". That way you can even mix and match GridSearch with Random search, pretty cool!
Edit: 27th of July '22: (based on the comment of #dpoiesz)
Just to make it a little more clear, as it is sampled from the intervals, concrete values are returned. Therefore, those are added to the grid dimension and grid search is performed using those
RealInterval is a min, max tuple in which the hparam will pick a number up.
Here a link to the implementation for better understanding.
The thing is that as it is currently implemented it does not seems to have any difference in between the two except if you call the sample_uniform method.
Note that tf.linspace breaks the mentioned sample code when saving current value.
See https://github.com/tensorflow/tensorboard/issues/2348
In particular OscarVanL's comment about his quick&dirty workaround.