How to use arrayformula to dynamically join strings in google spreadsheet? - google-sheets

I use Arrayformula() to make my reports dynamic and easier to edit. For example, if I have a Column A with a list o number o blue balls in a set and a Column B with a list red balls in a set, on the cell C1 I can write =ArrayFormula(add(A1:A,B1:B)) and in the Column C will have the total of balls in each set. It would be exactly the same as writing =A1+B1 in cell C1 and dragging the formula down to the last row. Arrayformula() has some benefits, because it will work if some adds or removes rows from the sheet and also it makes the reports way more organized and easier to edit.
Since I´ve discovered arrayformula(), my life has changed, because of the fact that googleSheets expands the formula to other cells. It does not work every time, but the idea of expanding to other cells seems to be possible some way or another, here is a good example of a problem that was not resolved by arrayformula(), but has the same idea.
Keeping that idea in mind, imagine that on Column A there is a list of First Names and on Column B there is a list of Last names. On Column C I want to join this two string using a simples space. The way to do that would be in the cell C1 write =join(" ",A1,B1) and then drag down this formula. This method method however is prone to error since people can add and remove rows, deleting my formula. I want to use a formula that I can write in one single cell and it expands to other cells. I´ve tried =arrayformula(join(" ",A1:A,B1:B)), but it does not work.
Is that a way to do that using =arrayformula() or other native function?
I know I could write a script or custom formula to do that, but this is not my goal here.

I think this formula should work:
=arrayformula(A1:A&" "&B1:B)

In case you want to use a delimiter, you can do the following to have a clean result even though, A or B is not present in some cases:
ARRAYFORMULA(ifna(ifs(isblank(A1:A),,ISBLANK(B1:B),A1:A),A1:A&" - "&B1:B))

Related

I'm looking for a Google Sheet array function to add specific increments in each row

Here's how it looks.
Hi. I'll try to be as specific as possible about this :)
I'm making a Google Sheet page similarly to a game character progression, that will automatically fill up based on data from other sheets: specifically, these "EXP" bars fill up with values based on the hidden cell A5.
For instance, the cells from D5 to BA5 represent LV1.
As the function shows, every time the value in A5 reaches an even number (for LV1, it's all even numbers from 2 to 100), one of the slots will fill up with a number, that with conditional formatting, will change the color of the cell and make it look like an actual exp bar filling up.
I'm using the function =COUNTIF(A5,">=2") and manually changing it to ">=4", ">=6" etc until ">=100" for the first bar. The second bar will have its 50 cells with all even numbers from ">=102" to ">=200".
So, to get to the question: is there an array formula that facilitates the process of filling a great amount of these bars with functions, without changing them all manually? Even automating *some *of this process would be great. Besides it being tedious, it leaves a lot of room for human error.
Thank you in advance to whoever's got an answer.
P
I haven't tried much as at the moment I am very confused by the vast amount of options array formulas provide. I have 48h of experience in the matter.
I suggest you to use the values of columns and rows here as helpers to do calculations. If you know that every column adds 2 and every row adds 100 you can set a formula like this for the whole range (select the whole range and add just one rule of conditional formatting):
=$A$5>((Column(D5)-3)*2+(Row(D5)-5)*100))
You use $symbol to make A5 steady and D5 value will "move" to each cell for conditional formatting, so you don't have to make an ARRAYFORMULA for this

Conditional Formatting on Google Sheets with Named Ranges

I've searched a bit for this issue and maybe I can get help here.
I'm trying to apply a conditional formatting through a named range and I only figured out that "Indirect" plays an huge role on this.
This is the typical table I'm working on, Heading, plus every row has a name with some notes. The table has a named range (Let's call it "Table") assigned to A1:D7 because I have some scripts on GAS that sort the list in different ways based on button pressing.
Since the table is updated pretty often, I just add rows to the "Table" Named range, so the script works fine.
Under the table the typical conditional formatting I use to color the zero or negative cells of both the column B and C but not the column D
Now what I have to do is to apply the whole conditional formatting on only the named range (but just the columns B and C).
I could "Apply to the range" B:C (So I don't have to change it) but under the table there are some other numeric data that I don't want to format.
Using a custom formula =INDIRECT("Table")<=0
doesn't work either since the table has the column Name, plus with some arrangements it colors both the cells B* and C* if the B value is negative and the C is not.
I'll probably add some more stuff since I'm working on it but if someone could aid just on this it would be very helpful
Browsing a bit and understanding that the Conditional formatting just cycle every cell in the range applied and uses the custom formula to check if it should format it or not, I should put it the fact that the cell has to be inside the named range as a condition.
I found this to be useful on a "B2:C" range =AND(NOT(ISERROR(INDEX(INDIRECT("Table"),ROW(B2),COLUMN(B2)))),*condition1_on_B2*,*condition2_on_B2*,*etc*)
(found it on the second post here on this link)
The first conditions returns true when the cell is not inside the named range
NOT to reverse the ISERROR value
ISERROR will return true if INDEX throws an error which is only when the cell is outside the named range
INDEX will attempt to find the cell B2 (or the cell the conditional formatting is checking on every iteration) inside the named range.
It probably is very heavy, performance-wise but for now it works, if there is something else, I'll wait for a better answer.

Google Sheets - Combining COUNTBACKGROUNDCOLOR and COUNTIF formulas

I want to count the amount a certain text(aus) appears in a column, but I only want to search the rows that have one specific color. I have the two seperate working formulas but haven't been able to combine them succesfully yet. Anybody an idea how to do this :) ? Here are the 2 formulas i have:
=COUNTBACKGROUNDCOLOR("J2:J361";"A2")
=COUNTIF(J2:J361; "*aus")
It appears as though you are using a script to implement your own function of COUNTBACKGROUNDCOLOR(). If this is the case you cannot combine the two functions as it stands since it is a user defined function. As MattKing pointed out maybe count the cells with your data AND the method used to declare the color (checkboxes). Example:
Conditional formatting applied to cells that highlight the cell green if adjacent checkbox is TRUE.
Formula used
Notice the answer is 2 and not 3 because from your formula you are only looking for wildcards before "aus" and Cell D4 contains a "?" at the END ("what is aus?")

Using the RIGHT function on a FORMULA within a cell?

I'm reformatting a sheet so I can utilise the data for some graphs. The existing formatting is a bit clunky to "transpose" to the required format, so I'm trying to figure out an easier way.
"Graphs" tab should transpose specific data from the "Statistics" tab - as can be seen. I'm trying to avoid creating manual cell references for the "Decks" column and instead extract the Col reference from the formula, increment it by 3, thus creating the next cell reference.
My attempt can be seen in A9.
I've tried googling how I can reference formula in a cell on a RIGHT function, but the keyword is giving a tonne of results that don't address my issue.
Here's the sheet!
https://docs.google.com/spreadsheets/d/1VKUhiwRGFMJOtDbLc0pqpckHFV7oNB2bjTqs2WqTqbo/edit?usp=sharing
=TRANSPOSE(FILTER(Statistics!H1:1, Statistics!H1:1<>""))

Multiple Layers of Matching Blank Cells

I'm back with another Google Sheets question. This one isn't scripting though - this time I'm looking for help in figuring out a formula.
I've attached screenshots of two sheets. The first one features one "opposing party" at row 8. The second one features an opposing part at row 8 and a second opposing party at row 9. Cell B3's formula is shown in both; in essence, Cell B3 looks for the first blank cell in column L after Row 10 (or Row 11 in the second image) and returns the contents of that row's "F" column. This allows me to "get" the next deadline in the matter that is being tracked. For those interested, yes, Cell D3 has a similar formula looking at K.
Currently, we have to manually update B3 (and D3) if we add additional parties (not necessarily opposing, and not just one either). This is more tedious than I would like. I would like a formula that would return "F10" and "L10" in situations where only one opposing party appears, "F11" and "L11" if there is an additional, and so on so that even if we have a massive, multi-party action it will still return the next cell.
If it helps, you can always assume that there will be a blank set of cells below the last "opposing party" and the row that we want to start querying (as shown in the second image).
I'd love any help that you can give. Please let me know if you need anything clarified.
Thanks a ton!
--Databoy2k
Is this what you require for B3?
=index(F:F, match("rule", I:I, 0)+1)
In a larger scope use,
=index(indirect("F"&match("Rule",I:I,0)&":F"), match(TRUE, index(isblank(indirect("L"&match("Rule",I:I,0)&":L")),0,0),0))
I think the easiest way would be to make the cells you are referencing a named range. That way, you can add as many other rows, columns, cells, whatever, and your formula will always reference the same range of cells.
For example, you could name the range of cells in column F 'Steps', and in K 'Deadline', then change your formula to =index(Steps,match(TRUE, index(isblank(Deadline),0,0),0)), and it will always give you the correct range.
Here's a pic to show how to name a range (right-click on the selection).

Resources