SPREADSHEET INDIRECT() with variable column - google-sheets

If A1 has a value of 2, =INDIRECT("L"&(5+A1)) will return me cell L7's content. And my A1 value keeps on being updated.
But I need a way to sort through columns instead of rows, like
L7, M7, N7, O7 and so on...
Which formula can help me sort through the columns? I also know that =COLUMN() returns the current column converted to number, but I had no luck with =INDIRECT((column()+A1)&7).

You can use the address() function inside indirect. Address() returns a cell reference as a string. So for example, if you enter in G5
=indirect(address(A1, column()))
while A1 is 1 the above formula will return the contents of cell G1.
See if this helps?

Related

How to find a value from a range of cells and place at a specific in google sheet

Suppose I have only one value anywhere at the cell range C2:Z2, I want that value at B2. What can I do?
I need this solution for all the rows bellow this also. The value might at C:C column at one row, at H:H column at another, that means it is dispersed at the range but there will be only one value at the range in a row.
Place this formula in B2:
=ARRAYFORMULA(TRIM(TRANSPOSE(QUERY(TRANSPOSE(C2:Z), , COLUMNS(C2:Z)))))
The formula above works for any type of values.
If your values are numbers then a simpler formula could be used (MMULT does row wise sum here):
=MMULT(
ARRAYFORMULA(--(C2:Z)),
SEQUENCE(COLUMNS(C2:Z), 1, 1, 0)
)
You can use FILTER()
=FILTER(C2:Z2, NOT(ISBLANK(C2:Z2)))
Reference:
FILTER()
if there will be only one value in the row then a simple sum function will do the job for you. put this in B2 ..
=sum(C2:Z2)

Lookup and Transpose functions to return multiple values in a cell

I want to use a type of lookup function that will return a range of cells instead of one cell. Then transpose that data.
Typical Vlookup function
VLOOKUP(Value_Lookup Range_Column_False)
I would like that column part to be a range in a row not a specific cell. For example:
If the value exists with the defined range, send the values of the entire row the initial value is in. Then transpose the range in a selected cell.
Is there a way to do this? I am only familiar with the vlookup function, would Index Match work?
Here is a link to an example spreadsheet:
Spreadsheet example
Please try:
=transpose(query(A1:EZ4,"select * where A ='Jimmy Medina' "))
Re supplementary, please try:
=transpose(query(A1:EZ4,"select * where A ='"&'Name Selection'!$A1&"' "))

Google Spreadsheets, match/lookup in ALL rows, except the current one

Google Spreadsheets, match/lookup in ALL rows, except the current one
I have never come across a method that looks in all rows, except the current.
Say you have a match or vlookup and it looks in ALL the rows except the current one the formula is in.
We use a formula like below that verifies if a certain value already exists (using a MAX), but if it finds itself then the match or vlookup is always 1 (or in error)
A B
1 Formula: Does value 1 from cell A1 exist in column A?
2 Formula: Does value 1 from cell A2 exist in column A?
3 Formula: Does value 1 from cell A3 exist in column A?
4 Formula: Does value 1 from cell A4 exist in column A? Check all except row 4
Something like this
Formula in cell C4: match(A4;A$1:A3&A5:A)
Or Formula in cell C4: match(A4;A:A&[^A4])
You can use this formula from the second row of data onward (B2=):
=IFERROR(MATCH(A2,A$1:A1,0),MATCH(A2,A3:A,0)+ROWS(A$1:A1)+1)
If there is no match above the current cell it will search for a match below, and will return the correct index in the full column range by adding ROWS(A$1:A1)+1 to the below match result.
Copy this formula downward from B2 to B3 and so on.
If you are trying to check whether the value appears in the column except for the current row just use COUNTIF()
Put this formula in B2
=ARRAYFORMULA(IF($A$2:$A="",,IF(COUNTIF($A2:$A,"="&$A2:A)>1,True,False)))
Otherwise please specify what kind of output you want

Count cells that contain any text

I want to count the cells that contain anything within a range.
Any cell that contain text, or numbers or something else should do a plus one in my result-cell.
I found this function,
countif(range; criteria)
but this doesn't work for me, because I don't know what to type in the criteria. How can I do this?
You can pass "<>" (including the quotes) as the parameter for criteria. This basically says, as long as its not empty/blank, count it. I believe this is what you want.
=COUNTIF(A1:A10, "<>")
Otherwise you can use CountA as Scott suggests
COUNTIF function will only count cells that contain numbers in your specified range.
COUNTA(range) will count all values in the list of arguments. Text entries and numbers are counted, even when they contain an empty string of length 0.
Example:
Function in A7
=COUNTA(A1:A6)
Range:
A1 a
A2 b
A3 banana
A4 42
A5
A6
A7 4 -> result
Google spreadsheet function list contains a list of all available functions for future reference https://support.google.com/drive/table/25273?hl=en.
The criterium should be "?*" and not "<>" because the latter will also count formulas that contain empty results, like ""
So the simplest formula would be
=COUNTIF(Range,"?*")
Sample file
Note:
Tried to find the formula for counting non-blank cells (="" is a blank cell) without a need to use data twice. The solution for goolge-spreadhseet: =ARRAYFORMULA(SUM(IFERROR(IF(data="",0,1),1))). For excel ={SUM(IFERROR(IF(data="",0,1),1))} should work (press Ctrl+Shift+Enter in the formula).
If you have cells with something like ="" and don't want to count them, you have to subtract number of empty cells from total number of cell by formula like
=row(G101)-row(G4)+1-countblank(G4:G101)
In case of 2-dimensional array it would be
=(row(G101)-row(A4)+1)*(column(G101)-column(A4)+1)-countblank(A4:G101)
Tested at google docs.
COUNTIF function can count cell which specific condition
where as COUNTA will count all cell which contain any value
Example: Function in A7: =COUNTA(A1:A6)
Range:
A1| a
A2| b
A3| banana
A4| 42
A5|
A6|
A7| 4 (result)
This works.
=ArrayFormula(SUM(IF(ISTEXT(put-your-range-of-text-mixed-with-anything-here),1,0),1))
IsText(range) looks at your data and returns True for every cell that is text and false for every one that is not. I think these are returned into a data table/array. See step 4.
If(IsText(range),1,0) takes the True/False values from the array/table returned by IsText in step 1, and translates the Trues into 1's and the Falses into 0's, as true integers, not strings.
Sum(range) then totals the 1's (Trues/Cells that are entirely text) and ignores the 0's (Falses/Cells not entirely text).
For some reason, ArrayFormula is needed to return the sum of all cells back into one cell, rather than returning the sum of all cells into a table of equal size. Idk. Would appreciate it if someone knowledgable could please add to this.
Bon chance.
to count any cells that has anything in it (including any text or number values, and also formulas that have text or numeric or blank results), then use:
=COUNTIF(A1:A10, "<>")
or
=COUNTA(A1:A10)
to count only cells that have a value that is NOT blank (including text or numeric values, or formulas that have numeric or text values, but NOT including formulas that have blank results) ie: cell value is longer than zero characters, then use:
=SUMPRODUCT(--(LEN(A1:A10)>0))
or
=COUNTA(FILTER(A1:A10, A1:A10 <> ""))
to count only cells that have a text (alphanumeric) value, then use:
=COUNTIF(A1:A10,"?*")
to count only cells that have a numeric value, then use:
=COUNT(A1:A10)
to count any cells that are blank (including cells that have no value, and cells where the formula result is blank), then use:
=COUNTBLANK(A1:A10)

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