Let user input a value in a cell containing a formula - google-sheets

I have a table that looks like this:
I'm not very familiar with google sheets yet, and I am looking for a way to allow users to input a value in one of the 4 cells containing a formula. Then the other cells would update according to the value the user entered in the cell he chose.
So if a user enters a value in B2 : B3 B4 and B5 would run the formula according to B2's value. And if then if he chooses to enter another value for B4 : B2 B3 and B5 would update accordingly.
I am not sure if what I have in mind is the correct way to do this, or if it is even possible at all. Any ideas on how to proceed?

I just answer according to my understanding, maybe I'm wrong to understand. I think you just paste your formula's in column c and allow your users to put values in B column, this is the way formula do automatic it for you. Sorry for bad English
I mean to put this in column c =B4/4 like bellow
and you get result like bellow

if you want to have custom inputs for values B2, B3, B4, B5 populate these cells with numbers and put your formulas in C column:
if you want to have custom inputs for values 4, 60, 30 then do it like this:

Related

Run filter in each row dynamically

I'm trying to manage a dynamic set of data over the course of several steps, and at each step I need to remove a specific value from each row, and shift the remaining values to the left to fill in any blanks.
I know I can use
=arrayformula(if(range=value, "", range))
to remove the specific value, but I've only been able to find
=filter(row, row<>"")
to fill in the blanks, but since the number of rows changes, this isn't going to work.
Edit:
I want to turn something like this
Column A
Column B
Column C
Data A1
Data B1
Data C1
Data A2
Data B2
Data C2
Data A3
Data B3
Data C3
Data A4
Data B4
Data C4
etc
etc
etc
to this
Column A
Column B
Column C
Data A1
Data C1
Data A2
Data B2
Data C2
Data B3
Data C3
Data C4
etc
etc
etc
Since I only know how many columns there are, I can only pre-set the formula to filter each column, which moves data vertically. I want to move it horizontally, but where the number of rows is variable, I can't manually pre-set each row to use filter.
Solution: applying FILTER() in combination with BYROW(). Because Google's BYROW() is unfortunately limited to a single value return from it's LAMBDA(), we have to rely on the old ARRAYFORMULA/JOIN/SPLIT trick.
=arrayformula(
split(
byrow(A1:C4,
lambda(row,
ifna(
join(",",
filter(row, row<>"A")),
""))),
","))
As of today (23-Jan-2023), it appears that Google has updated the BYROW/BYCOL functions to allow the return of an array result per row/column, so the answer to the OPs question could now simply be =byrow(range,lambda(row,filter(row,row<>""))).
I have not seen this documented anywhere, and the help pages for the BYROW & BYCOL functions still state that only a single value per row/column is allowed.
Slightly off-topic, but I can also confirm that you can pass the individual row/columns from a BYROW/BYCOL into the other LHFs as well (e.g. a SCAN within a BYROW to give a row-wise running total, etc.)

GSHEET How do I Extract Text from formula for creating automatic cell reference

The context :
Each time i need a cell reference from my other sheet, I need others cell reference from the same line but from different column.
I would like to automate those adding reference values depending on the first reference i add manually.
I have a sheet named alpha and a sheet named beta
I have a cell A1 in alpha that refers to beta A1
I have this referred cell formula in alpha A1 to have the value from beta A1
=beta!A1
Objectif :
I would like to have in alpha B2 the cell automatically filled-in by the value from beta A7
the equivalence of this refered cell formula
=beta!A7
Because the number seven will never change, only the column can change it could be:
=beta!AC1
so I will need =beta!AC7 automatically populated.
The Goal :
The goal is to extract from the formula in alpha A1 all characters except number(s) by a formula (like SEARCH, LEN, from FORMULATEXT) to obtain
=beta!A
with this result, I will concatenate with a cell that has the value "7". to obtain the formula for the cell reference.
A
B
C
1
=beta!A1
=beta!A7
7
2
=beta!AC1
=beta!AC7
If anyone can give me this formula clue or a better way to reach my goal would be good
I tried the regex below but it removed the punctuation
=REGEXREPLACE(FORMULATEXT(A1),"[^[:alpha:]]", "")&C1 where C1 is the value "7"
But i have all the need without the exclamation mark "!"
=betaA7
instead of
=beta!A7
Thank you
this is what you want
Use this to REGEXEXTRACT all the numbers and REGEXREPLACE then with "" nothing. and add &$C1 the value in C1.
=REGEXREPLACE(A1, REGEXEXTRACT(A1, "[0-9]+"), "")&$C1
A better way
See in Beta!A1 we have a value of Im beta A1
And in Beta!A7 we have a value of Im beta A7
And in alpha!A1 we hane the formula =beta!A1
To get the value of beta!A7 using the formula in alpha!A1 as an input we use this formula in beta!B1
=INDIRECT(REGEXREPLACE(SUBSTITUTE(FORMULATEXT(A1),"=",""), REGEXEXTRACT(SUBSTITUTE(FORMULATEXT(A1),"=",""), "[0-9]+"), "")&$C1)
Explanation
INDIRECT(=beta!A1)
Even more simpler approach
Use this formula directly
=OFFSET(beta!A1,C1-1,0)

Google sheets fill in the gaps using array formula

I have this table and the date column has some blanks if the dates are the same.
i.e. B3:B6 are all 31/01/2022
I want to use column F to fill in the gaps.
I would like to use an arrayformula in cell F2 and it stops when the relative A is empty
i.e. if A279 is empty, F279 is empty too.
I tried to do it using a non-array solution
=IF(B2="",F1,B2)
and I cannot change it to array one
=ArrayFormula(IF(B2:B="",F1,B2:B))
I don't know how to make F1 dynamic and the row number is always one less then B, like showing F2 if B3, F3 if B4
This is the Sheet
Try in F2
=ArrayFormula(lookup(row(A2:A),row(A2:A)/--(B2:B<>""),B2:B))
or (better) in F1
={"Date";ArrayFormula(if(A2:A="",,lookup(row(A2:A),row(A2:A)/--(B2:B<>""),B2:B)))}
to understand how it works, pls fill for instance in I2 =arrayformula(if(A2:A="",,row(A2:A)/--(B2:B<>""))) ... if Bx is blank, we get an error, in that case lookup will take the previous value without error.

Create 3 output results (rows) from one cell (Google Sheets)?

I found an issue, and I do not know if the title explains it precisely, but I somehow need to create 3 different output results (rows) based on the value in one;
I want to only enter one value in cells A2, A3, A4 (maybe have the cells merged?), the same in B2, B3, B4; C2, C3, C4 and D2, D3, D4. But in column E I need 3 output results for one value in B2.
What would be the most efficient way to do that?
Here is the sheet that I am working on:
https://docs.google.com/spreadsheets/d/1PYPjFr3Ny_ycDJ0PEgdd3y7VAW6J32RGtqqPLDIyXQ4/edit?usp=sharing
How can I do that with one formula based on value in B2 I will get 3 output results in column E that will concatenate string "MO_MED_" with B2 and add different endings _EDITABLE, _REQUIRED, _VISIBLE?
Just to make an explicit answer, the correct way to proceed here would be to use the CONCATENATE.

"Concatenate" math operation to cell value

Given data:
A1 = some value
A2 = operations needed like "*(-1) + today()"
Wanted result in A3 is formula which can take A1 and apply operations from A2.
Following my data sample if today is 10/25/2016 and A1 is 10/22/2016 I want to see "3" in A3.
Is this possible?
Yes this is possible by using Google Apps Script, getFormula or getFormulas methods.
Related question:
Is there a way to evaluate a formula that is stored in a cell?

Resources