Concatenate in Goggle sheet if NOT Blank - if-statement

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, ))

Related

Google Sheets Arrayformula with some sort of concatenate/textjoin/something similar for all rows

I'm trying to do an arrayformula that goes down all rows. I want it to grab the text from a specific row if the row that it's on meets conditions.
Here's an example of what I'm trying to do: have a formula in G5 that iterates through A:F. If the cell = "N", the grab the text from row 4 and concatenate it into a single string, with the text separated by commas.
I've looked at other questions on stack overflow but they're not quite the same.
Here's a sample Sheet
I've gotten as far as the formulas in K4 and P4, but can't figure out how to make it all one formula.
Any suggestions on how to do this?
use:
=ARRAYFORMULA(REGEXREPLACE(TRIM(FLATTEN(QUERY(TRANSPOSE(
IF(A5:F="N", A4:F4&",", )),,9^9))), ",$", ))

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.

Referencing Cell Result When Cell Includes Text And Formula

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

How to set a max number of characters in a cell and automatically skip 2 rows when max number of characters is reached in Google Sheets?

I'm looking for a way to do this in Google Sheets:
Set the maximum count of characters per cell of column D = 70.
If characters count of any cell in column D >= 70, then skip 2 rows.
Explanation:
I want to be able to write text in excel efficiently skipping 2 rows every 70 characters.
Example:
In Google Sheets cell D1, writing short sentences/strings of 70 characters max.
When cell D1 characters count >= 70, having the cursor automatically skip 2 rows (cells D2 and D3).
Continue writing/inputting the rest of the sentence/string from cell D1 directly into cell D4.
Do the same operations automatically from cell D4 to cell D7, from D7 to D10 etc. for all of column D.
Is this possible in Google Sheets without scripting?
If scripting is necessary, what would be a good way, to begin with?
Here's an additional thread about the question for Excel: https://www.mrexcel.com/forum/excel-questions/1081011-how-set-max-number-character-cell-automatically-skip-2-rows-when-max-number-character-reached-2.html#post5195931
ROBOTIC SOLUTION:
=ARRAYFORMULA(SUBSTITUTE(TRANSPOSE(SPLIT(REGEXREPLACE(A1,
"(.{70})", "♦$1"&"♀♂♀♂♀"), "♦♀")), "♂", ""))
AI SOLUTION:
=ARRAYFORMULA(SUBSTITUTE(TRANSPOSE(SPLIT(REGEXREPLACE(REGEXREPLACE(
REGEXREPLACE(A1&" ", "[\r\n\s]+", " "), "(\S.{0,70})\s",
"$1"&CHAR(10)&"♦"&CHAR(10)&"♦"&CHAR(10)&"♦"), "\n+\z", ""), "♦")), CHAR(10), ""))

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.