Copying data from cells in column A to C on Google sheets - google-sheets

To copy data from column A to column C
If Cell A empty, to take data from column B
If both cell empty mention Nil
Google Sheetlink - https://docs.google.com/spreadsheets/d/19M0DlaRY_JgcgyyG2GpGhuEpdqMiDX-y2YoTA0TIakQ/edit?usp=sharing
I have tried
=ARRAYFORMULA(IF(A2="",A2,B2))
The results are incorrect

Use MAP to get each value, IFS to check if empty and return appropriate values:
=MAP(A2:A15,B2:B15,LAMBDA(a,b,IFS(a<>"",a,b<>"",b,true,"Nil")))
Advantage: You only need to enter the range once.

try:
=INDEX(IF(A2:A10="", IF(B2:B10="", "Nil", B2:B10), A2:A10))
advantage: it's simple

Related

Last value of a column in Google Sheets

I was trying to use the following function;
=INDEX(D:D,COUNTA(D:D),1),
in order to get the last currency value of a column, but it returns #ERROR!.
The value im trying to extract
As I montly update this spreadsheet, it would make it very convenient if would etract the last value in the column, e.g. the value marked in the image.
Is there a way (in Google Sheets) to find the last non-empty cell in this column, such that when I update the spreadsheet with a new "last value" it would return that value?
The index(counta()) pattern will fail when the data is sparse, i.e., when there are blank values in the column.
The index(match()) pattern will fail when the data contains a value that is not a number.
To find the last non-blank value in column D, regardless of data type, use the +sort(row()) pattern:
=+sort(D1:D; not(isblank(D1:D)) * row(D1:D); false)
The formula uses semicolons as argument separators to make it work in any locale.
If the column has only currency (ie number) values then you can use something like:
=INDEX(D1:D, MATCH(999^99, D1:D))
or try:
=SORTN(D:D; 1;;ROW(D:D)*(D:D<>""); )

Google Sheets Fill Down with Formula

I have a very hard problem to solve, which must be completed with a formula (not a script).
Basically, the Raw input column needs to be dynamically filled down until it hits the next piece of text.
Here's an example file with includes the expected output.
https://docs.google.com/spreadsheets/d/1ibqCvY39NlhCRWsbBdxKITUUpVpp9wXdEz44T-pHDY0/
Is it even possible to achieve?
Thanks
This will work based on your ask, assuming that A2 is never blank, place this in the first row of data (not header):
=ArrayFormula(IF(A2:A<>"", A2:A, B1:B))
It checks to see if there is a value in column A, if there is, it fills that column, if not, it copies the cell above.
Delete everything in Column B (including the header) and place the following formula in B1:
=ArrayFormula({"Header";VLOOKUP(FILTER(ROW(A2:A),ROW(A2:A)<=MAX(FILTER(ROW(A2:A),A2:A<>""))),FILTER({ROW(A2:A),A2:A},A2:A<>""),2,TRUE)})
Here is a basic explanation of how this formula works:
A virtual array is created between the curly brackets { }; this virtual array contains a header and all results. You can change the header name to whatever you like.
VLOOKUP looks up every row number that is less than or equal to the highest row number that contains text in A2:A. Each of these qualifying rows is looked up in a second array that contains only the row numbers and Column-A data from non-blank rows, returning the data itself. Since rows are in perfect ascending order and the last parameter of VLOOKUP is set to TRUE, all blank rows in the first array will "fall backward" to find the most recent row that did have something in Column A.

Google Sheets Query and Comma Separated Data

I have a simple data query in a Google Sheet:
=query('2019'!$A$2:$A,"select A")
The data in column A has multiple cells that contain comma-separated values. Only the data in the first cell (A2) returns with all of the comma-separated values. How do I get all of the data returned in this query?
It's very likely the problem is cause because the data without commas are of ty numbers, boolean, dates, time, duration, in other works, they are not text values.
This happens because QUERY assigns a data type for each column based on a sample of each column data. If the column includes data of different type, they aren't included.
The way to solve this is to prior adding the data to QUERY convert all the column values to the same data type, in this case all should be text. To force that all the values are treated as text you could preppend and apostrophe / single quote. Other methods are
set the cell number formatting to plain text
concatenate the cell value to an empty text "" like =A1&""
try like this:
=ARRAYFORMULA(QUERY(TO_TEXT(2019!A2:A), "select A", 0)

Count number of cells with any value (string or number) in a column in Google Docs Spreadsheet

I have several columns in Google Spreadsheet.
I would like to count how many cells have a value (number or string) and display that number at the top of the column.
For example:
Hello
World
123
Some string
The above column would give me the answer of "4"
I have not managed to find a formula that does this.
In the cell you want your result to appear, use the following formula:
=COUNTIF(A1:A200,"<>")
That will count all cells which have a value and ignore all empty cells in the range of A1 to A200.
You could also use =COUNTA(A1:A200) which requires no conditions.
From Google Support:
COUNTA counts all values in a dataset, including those which appear
more than once and text values (including zero-length strings and
whitespace). To count unique values, use COUNTUNIQUE.
An additional trick beside using =COUNTIF(...) and =COUNTA(...) is:
=COUNTBLANK(A2:C100)
That will count all the empty cells.
This is useful for:
empty cells that doesn't contain data
formula that return blank or null
survey with missing answer fields which can be used for diff criterias
Shorter and dealing with a column (entire, not just a section of a column):
=COUNTA(A:A)
COUNTA
Beware, a cell containing just a space would be included in the count.
The SUBTOTAL function can be used if you want to get the count respecting any filters you use on the page.
=SUBTOTAL(103, A1:A200)
will help you get count of non-empty rows, respecting filters.
103 - is similar to COUNTA, but ignores empty rows and also respects filters.
Reference : SUBTOTAL function

how to concatenate a section of a column of data

Is it possible to use a cell to define the end of a range for a formula?
Essentially, I would like to use the JOIN() statement to concatenate a section of a column of data.
The data starts at a cell, say A5, and runs to a cell with the word 'total' in it. I've created a cell (let's call it L12) which returns the number of rows of data that are available.
I'd like to use that cell to form part of the range details of the JOIN() formula thus:
=JOIN(" ", A5: A[the value in L12]).
Is this possible?
I've found the indirect() function does exactly what I needed it to do.
See the Google function list https://support.google.com/docs/bin/static.py?hl=en&topic=25273&page=table.cs

Resources