I have a spreadsheet of data on Google Sheets where one order is spread over several rows, however, only the first row contains all the information. I need a way to copy the last populated cell down into all of the blanks.
So it looks like the left, but I need it to do what's on the right:
GB GB
- GB
AU AU
- AU
- AU
I've tried every formula I could find online, but they all either don't work or require pasting into every blank cell. This spreadsheet could reach 20,000+ rows, so I really need a formula that will do this automatically. I don't mind if it duplicates the whole column into a new column using an ARRAYFORMULA, I just need it to contain all the correct data.
To summarise, I want a formula that will take an entire column of a spreadsheet and populate every blank cell with the value in the last populated cell above it.
=ARRAYFORMULA(IF(ROW(A2:A) <= MAX(IF(NOT(ISBLANK(B2:B)), ROW(A2:A))),
VLOOKUP(ROW(A2:A), FILTER({ROW(A2:A), A2:A}, LEN(A2:A)), 2), ))
or remove NOT
Related
I'm wondering if there's a way to iterate over a list of values in a single cell, to then look up the value of each item in that last, and then to count how many times it occurs in another list. I would also be ok if we just put a list of the qualifying IDs in this cell. Here's a link to a demo of the data (https://docs.google.com/spreadsheets/d/1aoFIzQ9gjNYLQqpWO_6UVjn_JO9aWFSNOMyrT1VPK-0/edit?usp=sharing).
As an example, I would want to know how many of the IDs in cell B9 use "software" tools (J3:J). I would then place the count of this in D9. So, D9 should either say "4" or have the following IDs: 28, 72, 189, 534. E9 would say "2" or have following IDs: 141, 856, and F9 would say, "1" or have the ID: 664.
Is there a simple way of doing this?
paste in D9 and drag to the right:
=TEXTJOIN(",", 1, IFNA(FILTER($H:$H, $J:$J=D$2,
MATCH($H:$H, FLATTEN(SPLIT($B9, ",")), 0))))
and in C9:
=LEN(REGEXREPLACE(""&TEXTJOIN(",", 1, $D9:$F9), "[0-9]+", ))+1
If you would like an array solution (i.e., one formula per column that produces all results for all rows in that column), try this:
1.) For best performance, regardless of approach, you should keep each sheet trimmed to only the max number of columns and rows you anticipate ever needing. So I recommend that you first select and delete Rows 201 to 1001, and delete Column L to X (or delete any rows and columns beyond the maximum number you need in your real sheet). The formula proposed below will work whether you take this step or not; but you'll improve performance speed if you take this step, because every array formula must process all rows its provided, whether blank or not.
2.) Select and delete everything from D3:F (i.e., D3 as the upper left of the range and the last row in F as the bottom right of the range).
3.) Place the following formula into cell D3:
=ArrayFormula(MMULT(REGEXMATCH(IFERROR(LOWER(VLOOKUP(ARRAY_CONSTRAIN(SPLIT($B3:$B&REPT(",0",100),",",1),ROWS($B3:$B),100),$H:$J,3,FALSE))),LOWER(D2))*1,SEQUENCE(100,1,1,0)))
You will immediately see results fill in for all rows in Column D.
4.) Drag this formula to the right, into cells E3 and F3. Results for those columns will fill in accordingly for all rows.
The formula allows for up 100 comma-separated values in each cell of B3:B. However, if you think you won't ever have more than, say, 50, change the three instances of 100 in the formula to 50 (or to just above whatever you think the maximum number of values per cell will ever be). The closer you can get to that max, the more optimal the processing time will be.
In addition...
If you'd like to replace your Col-C values with a single array formula:
1.) Delete everything from C3:C.
2.) Place the following variation of your original Col-C formula in cell C3:
=ArrayFormula(IF(A3:A="",,LEN(B3:B)-LEN(SUBSTITUTE(B3:B,",",""))+1))
I have been googling multiple hours now and still cannot find a solution for a Google Sheets problem.
I have two images, the first image is in the cell A1 and the cellname is called "Image1". The second image is in B1 and the cellname is called "Image2". I have two columns of set names, all names in column1 are related to Image1, all names in column2 are related to Image2.
Column1: K1:K4
Column2: L1:L4
I want the name-related images to be displayed next to the names I write down in another column according to if its a name from column1 (Image1 should be displayed next to it) or a name from column2 (Image2 should be displayed next to it).
D4 = First cell where I start writing down names from column1
G4 = First cell where I start writing down names from coulmn2
If I only write down names from column1 I have no problem to display Image1 next to it. Same with names from column2.
I am using those formulas:
=IF(COUNTIF($K$1:$K$4,D4),Image1,"")
=IF(COUNTIF($L$1:$L$4,G4),Image2,"")
The images are displayed correctly to the related names.
Now, if I write and mix down names from both columns I don't know how to automatically display the correct image related to the name in the cell.
Is it possible to combine =IF(COUNTIF)) multiple times?
GoogleSheetsSample
Yes, you can use them together like this in cell J12 on your test sheet:
=IF(COUNTIF($K$1:$K$4,I12),Image1,IF(COUNTIF($L$1:$L$4,I12),Image2,""))
An arrayformula will save you the trouble of dragging down the formula. Add this to cell J12 and delete all content in J13:J1000:
=arrayformula(IF(COUNTIF(K:K,I12:I),Image1,IF(COUNTIF(L:L,I12:I),Image2,"")))
For the arrayformula to work, the criterion for each countif needs to be from the cell where the formula is located (eg, J12 in this example), to wherever you want the criterion to keep working to. I've deliberately left it to :J so it works to the bottom of the sheet.
The countif ranges don't need to be fixed and they can be the entire columns if you wish K:K and L:L. Or you could set a range if you don't want the countif to go past a certain row (eg. K1:K9 and L1:L9).
I have a sheet with several numbers, which I want to convert to percentage. These are scores imported from a form, where the maximum score is 5.
According to the bellow image, the cell B2, I applied a basic formula =(3/5)*100% to convert three to 60%.
In order to avoid copy and paste the same formula into all cells, is there any formula to find all the cells and apply its value, divide per 5 and multiple per 100%? I thought something similar to Javascript such as (this/5)*100%.
https://docs.google.com/spreadsheets/d/1ZtqJaXy1pHkjk1sywGfSodo0FcOoLlkou79cZBk-jmU/edit?usp=sharing
you could treat it as array and on Sheet2 use:
=ARRAYFORMULA(IF(Sheet1!B2:AA="";;(Sheet1!B2:AA/5)*100%))
demo sheet
I've also looked for a solution to this for some time.
I don't think it's possible as a cell can only hold one value and the moment you try to change that value, it will delete the value.
Your best bet is to create a different table on the same sheet that references the specified values, then copy and paste the results (values only).
Just create a second Sheet, then in cell B2 of Sheet2 use the formula =Sheet1!B2/5*100%.
Then copy the formula to all cells of Sheet2.
Example sheet: https://docs.google.com/spreadsheets/d/14ma-y3esh1S_EkzHpFBvLb0GzDZZiDsSVXFktH3Rr_E/edit?usp=sharing
In column B of ItemData sheet, I have achieved the result I want by copying the formula into every cell in the column, but I want to solve this using ArrayFormula instead.
In column C I have achieved the same result using ArrayFormula. However, for addition, column C is referring to cells in column B, while column B is referring to cells in column B. I.e. every cell in column B is adding 1 to the cell on the row above.
If I select the C3 formula text and paste it into the cell edit field for cell B3 (to not screw up cell references during copy - I know I could make them static references, but this is not my problem), the cell gets an error value of
#REF!
Error
Circular dependency detected. To resolve with iterative calculation, see File > Spreadsheet Settings.
Do note that the additions that need to be done are the same in both cases: Add 1 to the value of the cell on the previous row, so there is no circular reference involved. There is a starting value provided in B2, and cells in B3 and downwards should use the data from the B cell in the previous row.
Also, note that I did try File->Spreadsheet settings and enabling circular reference computation with max 25 items, but this only fills in the first two cells (B3 and B4).
How can I solve this problem? I would prefer having something like ArrayFormula, where the formula only exists in a single cell. But copy-pasting would be acceptable as long as any new rows, inserted in between or added at the bottom, would get the same formula added in column B.
Will matching items always be consecutive? It seems that way since you're comparing each Item cell to the cell above it right in your formula logic. That breaks an [unwritten?] rule of spreadsheet normalization; values' addresses themselves generally should not be treated as data.
IF you're committed to it though, have you considered explicitly using location as a data source? Example:
=ARRAYFORMULA(IFS(
NOT(LEN(A3:A40)),,
ROW(A3:A40)-3-MATCH(A3:A40,A$3:A$40,0)<=VLOOKUP(VLOOKUP(A3:A40,Items!$A$2:$D,2,false),DataPerColor!$A$2:$B,2,false),ROW(A3:A40)-3-MATCH(A3:A40,A$3:A$40,0),
true,
))
Just like your formulas, all that does in English is:
for each row,
if there's no Item, don't output any ItemData,
if the number that belongs in this cell¹ is less than or equal to the lookup, print it,
otherwise, don't output any ItemData
But then what is ¹ "the number that belongs in this cell" and how can we calculate it without using column B? I abuse locations of things to get it. Looking down your row B, each number that appears is just:
this row's number, minus
the row where items start [always 3], minus
the row number [in just the Item rows] of the first row containing this row's Item
Using the second-to-last ItemC as an example: the first ItemC is the 16th item listing, and the one we're looking up… the "second-to-last ItemC" is in row 21 of the sheet. 21-3-16 = 2 …the number you wanted.
If you can stomach that, it's a single formula and does work according to your specifications.
I am using google sheets to make a spread sheet and do some simple math, I figured how to do the summing but the problem is that I have about 180 rows of data and want to avoid, if possible, the need to make a formula for every single pair of data. Here is the simple code that I have:
=SUM(AG4:AG5)
So I am writing this code in this case in AH4 and is always the same relative placement to the values I want to add. I want the sum of the two numbers one column to the left and the current row and a row under that. Is there any way to make it so that the same formula can be used over and over instead of typing each one out. Maybe some way to make the formula look one column to the left take that number and add it to the cell one column to the left and one row down?
Thanks for any help you can provide.
You can use the ARRAYFORMULA function to apply a formula to multiple rows. It does not like some functions, though, and SUM() is one of them. So we need to use a different method to add the numbers. In this case, we just use AG4 + AG5. To apply the formula to all the rows in the spreadsheet we do a little more. Here is the formula, which would be placed in cell AG3 provided that is where the formula should start adding items.
=ARRAYFORMULA( IF( ISBLANK( AG3:AG),, AG2:AG + AG3:AG))
The IF ISBLANK AG3:AG) causes the formula to be applied to every row from row 3 to the last row in the sheet. ISBLANK will return FALSE on any row we want to work on so we provide nothing to teh TRUE portion of the IF statement. Note that I did not put "" in for the TRUE portion as that actually places a value in the row and can cause problems with other formulas. Since we are placing this in cell AG3 the addition will increment adding the row above to the current row.
EDIT from Comments
Placing this in cell AH2 will get you what you want:
=ARRAYFORMULA( IF( ISBLANK( AG2:AG),, IF(iseven( ROW(AG2:AG)),AG2:AG + AG3:AG,)))
Taking it a step farther, placing this in cell AH1 will label the header row for you and keep the formula out of the data rows. This has the advantage of allowing rows to be inserted above row 2.
=ARRAYFORMULA( IF(ROW(AH1:AH) = 1, "Total", IF( ISBLANK( AG1:AG),, IF(iseven( ROW(AG1:AG)),AG1:AG + AG2:AG,))))
The explanation is similar to above, only minor changes were made.
NOTE: The rest of column AH (below the formula) should not have any other manually entered data, so you will have to delete your formulas.