Referencing Cell Result When Cell Includes Text And Formula - regex

I have a cell, A1, with the formula:
="Revenue: $"&sum(B1:B5)
Let's say the sum of B1 through B5 is $100. I want to then create a cell, A2, with this formula referencing A1's result:
="Margin: $"&A1-25
The problem I'm encountering is that A1 includes text when I just want to include the resulting sum. How do I do this?

try:
="Margin: $"&REGEXEXTRACT(A1; "\$(.*)")-25

Since the string is always a fixed length you can just say grab everything after the 11th character:
="Margin: $"&mid(A1,11,9^9)-25

Related

Concatenate in Goggle sheet if NOT Blank

I have this formula in Google sheets
Basically, I want to concatenate only if Both Cells W2 and AA2 are NOT BLANK.
=IF(AND(NOT(ISBLANK(W2)),NOT(ISBLANK(AA2))),CONCATENATE(H2,"-",AA2),"")
It Concatenate me the cells because i guess W2 and AA2 have some Array formulas.
Is there a workaround this ?
use:
=IF((W2<>"")*(AA2<>""), H2&"-"&AA2, )
for AF use:
=ARRAYFORMULA(IF((W2:W<>"")*(AA2:AA<>""), H2:H2&"-"&AA2:AA, ))

I need to find links that contain the same number and merge them all into the same cell

can someone help me speed up the process in excel. I need formula to find links that contain the same number and merge them all into the same cell. So far I've done it with the formula but it's a slow process for me when I have over 1000 links:
=TEXTJOIN( ", ";TRUE;B110:B114)
Thanks!
Textjoin
I would use several columns.
Col B, extract the number from the strings with
=mid(A2,26,4)
Column C formula
=If(B2=B1, "", D2)
Column D
=IF(B2=B3, A2 & "," & D3, A2)
Copy those all the way down and answers with be in C. Filter out the blanks if you want.

Is there an error-proof way in google sheets to extract House numbers from address cell (street + house number) into another cell

In Sheet1!AK2:AK I have addresses in the following formats:
rotenkamper weg, 323, Kirchstieg 2345, Im Schleedörn 20b
I need the street names to export into Sheet2!C3:C, i.e:
rotenkamper weg, Kirchenstieg, Im Schleedörn
The House numbers have to go into Sheet2!D3:D.
I have researched and tried for hours but couldn't find a solution that could fetch the house numbers including the letter i.e. 20b or if the number is a range 24-27.
Also, I have huge trouble to get it to work when the street consist of two or more words.
Does anyone know an elegant solution for this?
Any help would be much appreciated. This will safe me weeks of data entry work.
Try this in Sheet2!C3:
=ARRAYFORMULA(
{
REGEXREPLACE(REGEXREPLACE(Sheet1!AK2:AK, "\s+\S*\d\S*\b", ""), ",+", ","),
IFNA(REGEXEXTRACT(Sheet1!AK2:AK, "\S+$"))
}
)
Explanation:
REGEXREPLACE(Sheet1!AK2:AK, "\s+\S*\d\S*\b", "") this one removes any "word" which has a digit in it. Al of these 323, 2345, 20b will be gone.
REGEXREPLACE(..., ",+", ",") cleans up any multiple consequent commas which may appear after removing in the first step. This will be a value for the first column.
IFNA(REGEXEXTRACT(Sheet1!AK2:AK, "\S+$")) this one just gets whatever is at the end of the address string from the last space to the end. This will be a value for the second column.
{value_for_the_first_column, value_for_the_second_column} placed in the C3 cell will populate C3 with value_for_the_first_column and D3 with value_for_the_first_column.
ARRAYFORMULA will do all of the above for every row.
Regex pattern could be refined if you provide more than one example of the address.

Suming multiple cells that may not be number

I am struggling with this for a while and would like to receive your help. What I am trying to do is to sum the values of D column multiplied by value of E column, but not just sum elements of D and then multiply by sum of elements of E but first, multiply elements of each row, so for ex D2 * E2, D3 * E3 etc and then sum up result of multiplication of from each row. I tried to achieve this with arrayFormula and sum, but the problem is that in both column there may appear not a number, but character 'X', so the solution I created will not work. I was trying to use sumif alongside with arrayformula but it is not working and have no idea what to try to change to make this work. The formula I came up with is:
=ARRAYFORMULA(SUMif(D2:D24*E2:E24;"<>*X*"))
Example data:
try simple:
=ARRAYFORMULA(SUM(IFERROR(A1:A*B1:B)))
The below code works for me:
=ARRAYFORMULA(SUM(if(D2:D24="X",0,D2:D24)*if(E2:E24="X",0,E2:E24)))
I am using the if() function to check for occurrence of "X" within the array, and replace it with 0 if "X" is found.

Concatenate a range of cells in OO Calc

I have column A with these cells:
A1: Apple
A2: Banana
A3: Cherry
I want a formula that will string them together in one cell like this:
"Apple, Banana, Cherry"
I don’t know if it’s implanted on OpenOffice but on his cousin LibreOffice Calc since the version 5.2 you’ve got the function : TEXTJOIN
TEXTJOIN( delimiter, skip_empty, string1[, string2][, …] )
delimiter is a text string and can be a range.skip_empty is a logical (TRUE or
FALSE, 1 or 0) argument. When TRUE, empty strings will be ignored.
string1[, string2][, …] are strings or references to cells or ranges
that contains text to join.
Ranges are traversed row by row (from top to bottom).
Example : =TEXTJOIN(",",1,A1:A10)
More info here :
https://help.libreoffice.org/6.3/en-US/text/scalc/01/func_textjoin.html?DbPAR=CALC#bm_id581556228060864
A different approach, suitable for a long list, would be to copy A1 to B1, prepend a " and in B2 enter:
=B1&", "&A2&IF(A3="";"""";"")
then double-click the fill handle to cell B2 (the small square at its bottom right). The result should appear in ColumnB in the row of the last entry of your list.
As of version 4.1.7 of Apache OpenOffice Calc, there still isn't a simple solution to this problem. CONCATENATE doesn't accept cell ranges, and there isn't a TEXTJOIN function like LibreOffice. However, there is a workaround.
This is essentially a duplicate of pnuts' answer, but with images to hopefully help. His answer explicitly addresses separating the items with delimiters, as well as the opening and closing quotations, as the question above uses. As the general question (how to concatenate a range of cells) is useful to many people, I think my answer should still be useful even though I haven't done that.
In my case, I had one column with letters corresponding to finished worksets, and one column with letters corresponding to unfinished worksets. The letters only appear on every 8th row, so I can't view them all at the same time. I wanted to just mash all the finished letters together in one cell to be easy to view, and the same with the unfinished letters.
The example removes the 7 empty rows per letter and manually inputs which letters are finished/unfinished for convenience.
Column A is the "unfinished" column to be concatenated. Column C is used to perform the concatenation. Row 2 is the first row, and row 24 is the final row. G1 shows the concatenated result in an easy-to-see spot near the top of the document.
Columns B and D, and cell G2, utilize the same method to show the "finished" data. The formulas aren't shown here.
In cell C2, point explicitly to A2:
=A2
If you may have blanks, as I do, there needs to be a conditional in C2 to treat the first cell as blank text, instead of as zero Note 1:
=IF (A2 <> "" ; A2 ; "")
Then, in cell C3, concatenate C2 and A3:
=C2 & A3
Copy C3, then highlight C4:C24 and paste the formula to autofill those cells.
Wherever you need the result of the concatenation, reference C24.
Notes
Note 1 If N cells at the top of the A row are blank and you just let C2 = A2, the first N rows on C will show 0, and a single 0 will be prepended to the concatenation result. Here, columns B and D are used to illustrate the problem:
Either use the CONCATENATE function or ampersands (&):
=CONCATENATE("""", A1, ", ", A2, ", ", A3, """")
For something more powerful, write a Basic macro that uses Join.
EDIT:
There is no function that can concatenate a range. Instead, write a Basic macro or drag and drop CONCATENATE formulas to multiple cells. See https://forum.openoffice.org/en/forum/viewtopic.php?f=9&t=5438.