How to append alpha characters in a spreadsheet (google sheets)? - google-sheets

I have a string: "region" in a cell. I would like to have a column automatically populate with:
regionA
regionB
regionC
regionD
I have found that by using "char(row(A65)" and then fill down I can auto populate alpha characters.
This works:
=concatenate(B12, char(row(A65)))
(b12 has the "region" string)
But when I do fill down it not only increments the A65 but also increments B12.
How do I have it only increment one part of this function?
I'm also open to other ways of doing this, anything that works.

If you add a $ before a part of the range, that part stays fixed or static.
So either
=concatenate(B$12, char(row(A65)))
or
=concatenate($B$12, char(row(A65)))
can be dragged down, and the B12 won't change. $B$12 could also be dragged sideways without changing.

Try:
=ARRAYFORMULA(B12&CHAR(SEQUENCE(4)+64))
The '4' will determine how many rows you are spilling down. Obviously this works up to 'Z'.
If you want to extend this further then try:
=ARRAYFORMULA(B12&REGEXEXTRACT(ADDRESS(1,SEQUENCE(100),4),"\D+"))
The '100' will determine the amount of rows you spill down.

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

Using the fill handle, but skipping cells

Is it possible to use the fill handle but have the pattern skip cells? Every time I try to start with a sheet like this:
When I use the fill handle sheets does this:
I've read that you need to select the entire pattern (for example, cells A1 through A9 in the example above), but that doesn't seem to make a difference for me.
You only need the 1 in A1. Nothing below it. Select A1:A3 (i.e., the 1 and two null cells) and then pull the fill handle down.
The solution was to autofill one row with the numbers and spaces using the fill handle (selecting the first three cells) and use the concatenate function on the others to fill the cell values. After this was done, it was just a matter of copy/paste!

Inspecting text in Google Sheets from vlookup without destroying formula, text wrapping, or changing column width to "fit to data"?

This has been an issue I've lived with for a really long time, without ever really figuring out a reasonable solution. I feel like there must be one, however.
I do a lot of spreadsheet preparation for non-technical users. In my current situation, it involves a selection committee that needs to view candidates' submissions. The problem is, each candidate's responses vary quite a bit in length and size. I am using very basic VLOOKUP's to populate a series of columns so that when a given applicant is chosen from a dropdown menu.
Here is the dilemma, to me it feels like there must be a way to view the entire content of a vlookup result WITHOUT having to change row/column width/height to "fit to data" or some arbitrary huge number. For normal text boxes that get cut off, you can just double click the cell, and it neatly displays the entire text content for you. When I try to do this with a vlookup formula, double-clicking just displays the vlookup formula itself. The only way around this I've found is copying the cell, then doing paste-special and choosing "value only". But doing this destroys the vlookup formula, requiring a quick control-Z to undo afterwards -- something fine for me, but not something I can't reliably ask my end users to know to do.
Put succinctly, is there no other way to display/access the entire text content of a cell that is cutoff, if the content is the result of a v or hlookup formula? A way, that is, without value pasting over the formula, or having to adjust the column width and/or choose 'wrap text' and changing the row height?
I was hoping there might be some way to get the contents of the vlookup to appear in something like a tooltip popup if you hover over the cell? Or some other solution.
move your vlookup formula up a row like if its now in B2 and the output of vlookup is 1 column put this in B1:
={""; ARRAYFORMULA(IFNA(VLOOKUP(...)))}

Counting the Number of Empty Cells between Non-Empty Cells in Google Sheets

I'm trying to count the number of empty cells that exist in a column between each non-empty cell but haven't been able to work out how.
Using this, I'm also trying to find the largest "empty distances" and locate the cell in the center of these distances.
The sheet I'm working with lists a set of marker colors and denotes the ones that are owned out of the full set of colors. I'm trying to find the largest ranges of missing colors and then find the colors in the middle of those ranges in order to find a handful of markers that would best help to fill out the spectrum.
Columns 1-6 are information- Column 7 marks whether the color is owned:
I may have an answer that helps you.
I could only get it to work using a helper column, but someone may know how to eliminate that requirement.
The helper column creates an array, basically listing the row numbers of the rows that have an "x" in your column B.
The main formula then measures the gap between each of these listed row numbers. It also checks the gap before the first "x", and after the last "x". Note that I have the data starting on row 2, which complicates the formula, but makes the sample sheet clearer - this can easily be changed to row 1 if you prefer.
={F2-1;
query(ArrayFormula(if(isnumber(F3:F),F3:F-F2:F-1,"")),
"select Col1 where Col1 > 0",0);
counta(A2:A)-indirect("F"&COUNTA(F$2:F))}
See a sample sheet here:
https://docs.google.com/spreadsheets/d/19QUFGRqTT6BqOsBrEBpTIxQCeNdRa5mzXhxQpCZ8sV4/edit?usp=sharing
Then I used a second formula to calculate the max gap between "x"s, (or before the first or after the last x).
Note that calculating the midpoint of the gaps, and doing a lookup of the corresponding mid-point colour, is something that can be added to this answer, if you share a sample copy of your sheet and share it for editing.
Let me know if this helps. I'll add more explanation to describe what the formula is doing tomorrow.
And I'll provide a second tab with the formulas adjusted to work with data beginning on row 1.
You can also get the lengths of the gaps using Frequency:
=ArrayFormula(frequency(if((B1:B20<>"X")*(A1:A20<>""),row(B1:B20)),if((B1:B20="X")*(A1:A20<>""),row(B1:B20))))
but finding the centres of the gaps and allowing for equal-sized gaps is more difficult.
This should find the position of the "X" at the end of the longest gap:
=ArrayFormula(
sum(frequency(if((B1:B20<>"X")*(A1:A20<>""),row(B1:B20)),
if((B1:B20="X")*(A1:A20<>""),row(B1:B20)))*(sequence(countif(B1:B20,"X")+1,1)<=
match(max(frequency(if((B1:B20<>"X")*(A1:A20<>""),row(B1:B20)),
if((B1:B20="X")*(A1:A20<>""),row(B1:B20)))),frequency(if((B1:B20<>"X")*(A1:A20<>""),row(B1:B20)),
if((B1:B20="X")*(A1:A20<>""),row(B1:B20))),0)))+
countif(sequence(countif(B1:B20,"X")+1,1),"<="&
match(max(frequency(if((B1:B20<>"X")*(A1:A20<>""),row(B1:B20)),
if((B1:B20="X")*(A1:A20<>""),row(B1:B20)))),frequency(if((B1:B20<>"X")*(A1:A20<>""),row(B1:B20)),
if((B1:B20="X")*(A1:A20<>""),row(B1:B20))),0))
)
and then it should just be a case of working backwards from there to the centre of the longest gap. However the formula needs further refinement to deal with the cases
(1) Where the longest gap is after the last "X"
(2) Where there is a tie for the longest gap
(3) Where there is a need to list the longest, second longest, third longest gap etc.

How to delete empty cells and shift up in Google Sheets?

Is there a way to delete empty cells in a given range and shift the column up to the desired display as shown below? Closest I came was
=ARRAYFORMULA({A1:C1; TRANSPOSE(SPLIT(TRANSPOSE(QUERY(A2:C,,999^99)), " "))})
which removes empty cells, but splits the first names and surnames into separate cells, which I have not figured out how to avoid. Pfa a made-up sample of current and desired displays:
Current Display
Desired Display
I'm new at this, but I came up with a bit of a brute force method, which may help you.
={
{(A1:C1)};
{FILTER(A2:A100,A2:A100<>"");indirect("N1:N" & 100-counta(A2:A100))},
{FILTER(B2:B100,B2:B100<>"");indirect("N1:N" & 100-counta(B2:B100))},
{FILTER(C2:C100,C2:C100<>"");indirect("N1:N" & 100-counta(C2:C100))}}
Assuming your data block is in columns A1:C100, this formula filters blank cells from each individual column, and then pads each column with blank cells at the bottom, to make the three arrays equal in length/dimension.
Note that in "100-counta(...", the 100 is the expected maximum length of your data column.
This could be calculated, and must be the same for all three columns.
Note also that the first array is horizontal (ends with a semi-colon), followed by the three columns, stacked beside each other (ends with a comma).
Here is a working example.
https://docs.google.com/spreadsheets/d/1MGaqqGrkmIliuAzEqxPtdEVZXWPN2K5W7jFFM-ZnwgE/edit?usp=sharing
If I missed something you were trying to achieve, let me know.
Also, I'm sure that there is a more elegant way to do this, or one not requiring the use of a block of "reserved" blank cells, but I couldn't think of that at the moment.
Edit: The formula as follows also works. But you need to remember to set the "100" value to be equal to the number of rows in your data block, since we pad the columns with the necessary number of blanks rows, after removing the blank cells in each column.
={
{(A1:C1)};
{FILTER(A2:A,A2:A<>"");indirect("N1:N" & 100-counta(A2:A))},
{FILTER(B2:B,B2:B<>"");indirect("N1:N" & 100-counta(B2:B))},
{FILTER(C2:C,C2:C<>"");indirect("N1:N" & 100-counta(C2:C))}}

Resources