openoffice calc use contents of a cell as the formula for another - openoffice-calc

I searched for this and couldn't find how to do it. I have a cell that has an equation like: ".25 + .33" which I want displayed exactly like that. In the cell next to it, I want it to give me the result of that equation, ie, to turn that into "=.25 - .33" and show the result. I know I could do it the other way around, typing the formula out, and then using =FORMULA() and REPLACE() to remove the '=' or even use macros. But that's not what I want in this case. Is there a way to do this? I tried looking at functions like =INDIRECT() but no joy.

Given the constraints you have chosen, in a word, No.

Related

perform mathematical operations on a number without changing the attached text

I need a formula that can multiply or divide all the numbers in a string without changing the text attached to the numbers.
I need the numbers in the next column to automatically change according to the given mathematical operation, but the text from the original line must remain unchanged.
I've tried using a combination of REGEXMATCH and REGEXEXTRACT and by doing this I just get the result of multiplying/dividing all the numbers in the string (no text whatsoever).
I also had no success using REGEXREPLACE. I'm not even sure we can actually use it in this case, and maybe I need a different formula instead. Maybe you first need to extract the numbers, multiply them and use something like TEXTJOIN or CONCATENATE to put them together in a string with the values already changed, and is this even possible in this specific example? It's totally fine to perform the operation in several steps if needed (for example, adding SPLIT function or something like that), but the format of the raw data we need to enter and recalculate, unfortunately, cannot be modified.
A sample table for better visualisation can be seen below. Any help would be greatly appreciated!
Raw data
Operation
Desired outcome
25STR/40DEX/70FRES
*0.25
6.25STR/10DEX/17.5FRES
80VIT/30INT/50CRES
*0.75
60STR/22.5INT/37.5CRES
60VIT/20STR/45LRES
*1.25
75VIT/25STR/56.25LRES
You may try:
=byrow(index(bycol(split(A2:A,"/"),lambda(z,ifna(ifs(left(B2:B,1)="*",regexextract(z,"\d+")*mid(B2:B,2,99),left(B2:B,1)="/",round(regexextract(z,"\d+")/mid(B2:B,2,99),2))&regexextract(z,"\d+(.*)"))))),lambda(y,if(y="",,join("/",y))))

Regexmatch for multiple words in Sheets

I'm trying to write a REGEXMATCH formula for Sheets that will analyze all of the text in a cell and then write a given keyword into another cell.
I've figured out how to do this for a single keyword: for example,
=IF(REGEXMATCH(F3, "czech"),"CZ",IF(REGEXMATCH(F3, "african"),"AF",IF(REGEXMATCH(F3, "mykonos"),"MK")))
What I'm having trouble with though is writing one of these values only if two or more terms are matched in the reference cell.
If I were trying to match one of two words, I realize I could use | as in:
=IF(REGEXMATCH(F3, "czech|coin"),"CZC"
etc
But in this instance I only want to produce CZC if the previous cell contains BOTH czech AND coin.
Can someone help me with this?
try like this:
=IF((REGEXMATCH(F3, "czech"))*(REGEXMATCH(F3, "coin")), "CZC", )
multiplication stands for AND

Arrayformula to check if column contains text and pull the number next to it. Google Sheets

In desperate need of some assistance with this!
Wasn't sure how to title this question...
SAMPLE SHEET - CLICK ME! :)
In SupportingSheet!H1 I have the following formula:
=ArrayFormula(if(G1:G<>"", IF(DASHBOARD!N2<>"", G1:G/DASHBOARD!$P$2-filter(DASHBOARD!O1:O100,REGEXMATCH(DASHBOARD!N1:N100,E1:E100)),G1:G/(DASHBOARD!$M$3)),))
The part I struggle with is:
G1:G/DASHBOARD!$P$2-filter(DASHBOARD!O1:O100,REGEXMATCH(DASHBOARD!N1:N100,E1:E100))
It needs to divide two numbers and then subtract another number. I can't seem to get this formula to pull the correct number.
It needs to check if the text in E1:E100 exist in DASHBOARD!N1:N100, if yes, pull the number from DASHBOARD!O1:O100.
For example, text in SupportingSheet!E1 can be found in DASHBOARD!N2, hence it needs to pull the number from DASHBOARD!O2.
Column SupportingSheet!J has the actual end result that a formula needs to produce.
It doesn't look like Regexmatch works as an Arrayformula and I am not sure how to go about it.
Please note, that text in SupportingSheet!E1:E is not always identical. Often it will have a random number of "space" at the end (long story...). That is why Regexmatch was a perfect option until I realised it didn't work.
Please let me know if further clarification is needed.
Below is an image of the random spaces (non-printable characters) at the end.
use:
=ARRAYFORMULA(IF(G1:G="",,IF(DASHBOARD!N2<>"",
IFNA(G1:G/DASHBOARD!$P$2-VLOOKUP(E1:E1000, DASHBOARD!N1:O100, 2, 0),
G1:G/DASHBOARD!$M$3))))

Using arrayformula to add suffix, but would like to skip empty cells

I am using an arrayformula to add .png suffix to the text in column A. Right now it looks like this:
=arrayformula(A:A &".png" )
Since I want this to be a part of a macro, I won't manually be able to choose the exact range.
So how do I limit the formula, to only add the suffix, if the cells in column A had any text in it, to begin with? Right now I end up with a lot of cells where it just says ".png" because the cell was empty.
I have tried playing around with =if(istext(A:A) but I couldn't figure out how to construct the statement. And maybe it is not the way to go?
try:
=ARRAYFORMULA(INDIRECT("A1:A"&COUNTA(A:A))&".png")
or shorter:
=ARRAYFORMULA(IF(A:A="",,A:A&".png")
or regex:
=ARRAYFORMULA(REGEXREPLACE(A:A, "(.+)", "$1.png"))
See if this helps
=Arrayformula(if(len(A:A), A:A&".png",))
Using below code
=ARRAYFORMULA(A1:A&".png")
should do the thing.

Google Sheets: Multiple "if" and "find" within an Array formula

background info - not important
I realise I need improvement on understanding logic and understanding documentation when playing around with Android apps. So, I thought I'll switch to Google Sheets in the hope of some basic practice in a context I might find easier to understand.
question
I've set up a Google Sheet:
https://docs.google.com/spreadsheets/d/1T7q_CGMFObxS_0DGikUdSdLTf97XmEPXY0S7yItuA5Y/edit?usp=sharing
I would like Column B to:
display "Folder1" if "Black" is found in the adjacent Column A cell.
display "Folder2" if "Blue" is found in the adjacent Column A cell.
display "Folder3" if "Green" is found in the adjacent Column A cell.
and to then be able to add more conditions.
My formula for Column B is currently:
=ARRAYFORMULA(
IFS(
find("Black", A2:A,1)>0,"Folder1",
find("Blue", A2:A,1)>0,"Folder2",
find("Green", A2:A,1)>0,"Folder3")
)
Which is only meeting the first condition "Folder1" if "Black" is found and not continuing with the rest of the if clauses.
I think I have nested it correctly though because all of the IFS() are at the same level with their corresponding find() within. And, I have two closing brackets which close the IFS and the ARRAYFORMULA.
Am I just simply not using the right kind of functions for what I'd like to do?
Thank you for your suggestions on how I can solve this!
The problem is that find() only returns a number > 0 if it actually finds a match. Otherwise it returns an error which you can't test for explicitly.
You can fix you code like this:
=ARRAYFORMULA(
IFS(
isnumber(find("Black", A2:A,1)),"Folder1",
isnumber(find("Blue", A2:A,1)),"Folder2",
isnumber(find("Green", A2:A,1)),"Folder3")
)
Now we can test that what find() returns is an number and the code will work!
Obviously, I put on multiple lines for clarity.