#REF! error in google sheets - google-sheets

I have a spread sheet which can be viewed at https://docs.google.com/spreadsheets/d/1bhIV1ULLXhjdSO_5Q5l5ZNe7Zaxrj15CYMW88FMFgRU/edit?usp=sharing
The way the spread sheet works is when a selection from the list is made the specific cells reference a data table and fills in the respective cells. This works perfectly in excel and I just use Iferror to hide the circular references. This is not the case in google sheets as the #REF! error still appears. How can I rectify so that they no longer appear? I have tried unique but it makes all the cells bank even when a different selection from the drop down box is made.

You can use the ISREF() function for this. Combine it with an IF() and you're good to go:
IF(ISREF('sheetname'!A4), 'sheetname'!A4, "")

The problem is that the formula itself is fine but (for column N) 'Attributes-InSeason-Trade_Mach'!$L121 and the following rows evaluate to "".
This means for INDEX in Google Spreadsheets that it will use all rows which in turn would overwrite the data in the next row because INDEX will be returning a range, not a single cell.
The Formula itself is evaluating fine, it does not cause an error which is why IFERROR does not trigger the alterantive "", the problem happens after the evaluation when it is trying to display the data.
You can just wrap the INDEX Call inside of an IF like this (This is an example for Column N)
=IFERROR(IF('Attributes-InSeason-Trade_Mach'!$L110 <> "",
INDEX('Attributes-InSeason-Trade_Mach'!$H$110:$I$214,
'Attributes-InSeason-Trade_Mach'!$L110,
COLUMNS(Trade_Machine!$P$4:P4)), ""), "")

Related

Compiling a list using INDEX but need to skip certain rows

I'm compiling a list based on the first answers recieved between row N and AF.
I'm using these two formulas:
=INDEX(N2:O2,MATCH(FALSE,ISBLANK(N2:O2),0))
and
=INDEX(R2:AF2,MATCH(FALSE,ISBLANK(R2:AF2),0))
Is there a way to combine them whilst not searching in rows P & Q?
These are generated from a Form response so can't just be switched around.
try:
=INDEX({N2:O2, R2:AF2}, MATCH(FALSE, ISBLANK({N2:O2, R2:AF2}), 0))
If Sheet1 is an intake sheet of form results, you should not add any data, formulas or even formatting to that sheet. It virtually always causes issues. A form intake sheet should be left exactly as it is. A new sheet can then be used to bring over the results of the form intake sheet as you want to see them.
However, since you didn't specify any of that, I will supply a formula written to work in the same sheet as your posted example and in-sheet examples.
Clear an entire column and place the following in the top cell of that column:
=ArrayFormula({"Attendee Name"; IF(E2:E="",,IFERROR(REGEXEXTRACT(TRIM(TRANSPOSE(QUERY(TRANSPOSE(FILTER(IF(N2:AK="",,N2:AK&"~"),N1:AK1=N1)),,COLUMNS(N1:AK1)))),"\s*([^~]+)"),"(none listed)"))})
This one formula will produce a header (the text of which you can change within the formula itself as you lie) and all valid results for all rows.
The inner IF will append a tilde (~) to any non-null entries in the range N2:AK.
FILTER will keep only those columns in this range where the header is the same as the header in N1 (i.e., "Attendee Name").
TRANSPOSE(QUERY(TRANSPOSE( ),,COLUMNS( ))) is colloquially called a "Query smash." It will form one cell from all horizontal results per row.
TRIM will cut any preliminary spaces and form a true string.
REGEXEXTRACT will pull the from the first non-space character up to but not including the first tilde (from those appended in the first step)—in other words, the first full valid entry from any column.
IFERROR will return a message if there is an error, with the likely error being that there were no valid entries for "Attendee name" in any column.
The outer IF will leave the cell blank if the no training event exists in E2:E.
{ } forms a virtual array that places the header over all other results.
ArrayFormula( ) signifies that multiple results will be processed at once.
Because this is an array formula that is being "asked" to process every row, you cannot manually type into any cell of this results column. If you do, you will "break the array"; everything except what you just typed will disappear, leaving only an error in the formula cell. If you need to add or change a name, you need to do that in the raw results range (e.g., manually type a name or a new name in Col N), which will then turn up in the formula output range.

How to give a cell containing with 'ISREF' a default value in Google Sheets

I am trying to use a formula that uses INDEX function. In order to generalize for all the lines that sometimes may contain information from another sheet and sometimes they may not.
That's why I get an ISREF error within the cells because the corresponding cells in the other sheet can't be referenced.
I want to display a default value instead of the ISREF error message. I tried using ISREF function itself within an IF condition but it doesn't work on the same cell. It only references another cell because it is a cell checking function and it doesn't check the output of a formula.
I tried also ISERROR function but it didn't work also. Here's a snippet of the formula that I am putting within my cell:'
INDEX(Plagesuivi; $Q203; 9)
Plagesuivi is a named range
$Q203 contains the row number (that I fetch dynamically and correctly)
9 is the column number
P.S. The indexing is working fine with cells that do appear is the named range: Plagesuivi
I would go with iferror() like this:
=iferror(INDEX(Plagesuivi;$Q203;9);0)
Or replace the 0 with ""
After trial and error the best way to avoid all sorts of errors is:
= IF($Q203=""; 0; IFERROR(INDEX(Plagesuivi; $Q203; 9); 0))
IFERROR checks for all sorts of unpredictable errrors it is a safe-guard against unpredicted cases where it takes 0 by default.
IF in the second case checks whether the referencing content of Q203 is empty or not, in case it is empty the cell takes 0 by default else it gets the output of the false case formula.

Google Sheets - IF statement with INDEX arguments giving me #ERROR (Parse Error)

To give some detail, I am using Google Forms + Google Sheets to make an easy database that collects all the bank information I put in (Income, savings, expenses, etc.) and I can keep track of details with easy sorting.
I'm stuck on a formula that I can't seem to figure out. Before I go in to specific details of my code I will give a small explanation. The cell I am trying to populate [with the formula] is supposed to take 2 pieces of information from the form response sheet (I will refer to it as 'rawdata') and produce a value (number) from another cell in 'rawdata'.
So in 'rawdata' I have a column (B) that has a value of "Expense" or "Income" for a form response line. I have a column (D) in 'rawdata' that has the value of "Amount" for the number submitted.
Cells in reference in 'rawdata':
B9 = "Expense"
D9 = 67.37
Now, due to the original 'rawdata' being a form response sheet it inserts new rows every response, so my attempt at just calling direction to the cell fails upon a new response submission because it increments on its own. So that being a solution is out of the question.
So, for every other cell I am using to display values from 'rawdata' in an organized sheet I use =INDEX() to pull the value from that exact row and column, instead of the cell reference and it has worked so far.
=INDEX(rawdata!$B:$B,ROW(9:9)) displays "Expense" from 'rawdata' in B9 as a result. So the rest of the cells are formulated this way and I have had no issues.
When I got to the amount, I used an =IF() formula to pull the value from the D column and to display it either as a negative or positive depending on what column B states.
=IF(rawdata!B8="Expense", -rawdata!$D9, rawdata!$D9) displays -67.37 as a result.
But since I can't use this formula to fill empty cells for future use I have to find another way to do so. I figure;
=IF(=INDEX(rawdata!$B:$B,ROW(9:9)) = "Expense", =INDEX(-rawdata!$D:$D,ROW(9:9)), =INDEX(rawdata!$D:$D,ROW(9:9)))
is my solution to the problem, because to me it makes sense. But it fails and gives me a Parse Error.
So when I try to run the first =INDEX() with the values of 1 or 0 being the outcome of the =IF() it also fails, so I create a new column in the sorted table to pull the data of "Expense" or "Income" so I can reference that.
Cell in 'processeddata':
E9 = "Expense"
=IF(E9="Expense", 1, 0) displays 1 as its result, so I figure this is the solution to my problem.
=IF(E9="Expense", =INDEX(-rawdata!$D:$D,ROW(9:9)), =INDEX(rawdata!$D:$D,ROW(9:9)))
displays #ERROR with the description Parse Error.
=INDEX(-rawdata!$D:$D,ROW(9:9)) displays -67.37
=INDEX(rawdata!$D:$D,ROW(9:9)) displays 67.37
I'm at a loss for what to do now. I've exhausted myself with tons of searching on here and all over google, tried using things like INDEX and MATCH, VLOOKUP, etc but can't solve this to save my life. Does anyone here have a clue how I can solve this with a cell reference that won't increment when new rows are added in 'rawdata'?
PS. I've also attempted using =VALUE() to try and convert the =INDEX() to a number but no luck.
Your formula has superfluous equals signs (=). Try Insert > Column and this formula in row 8 of the new column:
=arrayformula( if(rawdata!B8:B = "Expense", -rawdata!D8:D, rawdata!D8:D) )
Your formula has some equal signs in it that are probably the issue.
Instead of this:
IF(=INDEX(rawdata!$B:$B,ROW(9:9)) = "Expense", =INDEX(-rawdata!$D:$D,ROW(9:9)), =INDEX(rawdata!$D:$D,ROW(9:9)))
try this:
IF(INDEX(rawdata!$B:$B,ROW(9:9)) = "Expense", INDEX(-rawdata!$D:$D,ROW(9:9)), INDEX(rawdata!$D:$D,ROW(9:9)))
Also, an array formula is a great tool for Form data calculations. In this file you can see a formula in Column F that does a calculation in each row of the responses sheet from this form, it will continue to update as new entries are made. Feel free to enter submit some form responses.

How to insert row with formula that links cell? Google Sheets API

The answer is next:
1) There is formula in Google Sheet cell "A11", for example "=F11+C11";
2) I append multiple data to this Google Sheet list with the help of
https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/batchUpdate
or https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append
3) I need to append the value for "A12" using its current position. It had to become "=F12+C12".
Or if I append data on top
(as described here - Google sheets API append method (last on top))
I need that formulas under my append changed to correct value. If current value of "A11" is "=F11+C11" then,
if I add 3 rows before this row, it becomes "A14" cell and it's value had to be changed to "=F14+C14"
Is there any way to realise both this scenarious directly in Google Sheets API request? May be there is some settings in Google Sheet that can help me (something like formating of cells/columns etc)?
UPD. For now it all works fine except of that incident when formula returns exception! My questions is not actual for now, but I still not understand in which cases formulas will change and in which they will not.
The answer is quiet simple!
I update cell 'A13' with formula '=B2+C2' and as cells 'B2' and 'C2' stay on their places after every changes my cell 'A13' still link cells 'B2' and 'C2'.
But if I will add row before 'B2' and/or 'C2' then formula will change and my cell 'A13' will link 'B3' and 'C3'.

ARRAYFORMULA VLOOKUP with ISBLANK in google sheets

I am trying to get a VLOOKUP to work on an entire column (minus the header), but I want blank entries if the column I am searching for is empty. I tried both these formulas, but to no avail (I still get the N/A in empty cells):
=ARRAYFORMULA(IF(ISBLANK(VLOOKUP(O2:O,Sheet1!B:C,2,FALSE)),"",VLOOKUP(O2:O,Sheet1!B:C,2,FALSE)))
=ARRAYFORMULA(IF(O2:O<>"",VLOOKUP(O2:O,Sheet1!B:C,2,FALSE)),"")
This is a slightly more complicated way than what I got working in another part of my sheet, which is the same without the VLOOKUP:
=ARRAYFORMULA(IF(ISBLANK(J2:J),"",J2:J))
Any ideas what am I doing wrong?
If you want to leave a blank instead of #N/A in a cell, you can use =IFERROR.
Like this:
=IFERROR(Your_formula, "value if the formula returns an error")
Since you are using ARRAYFORMULA, the iferror must be inside it
=ARRAYFORMULA(IFERROR(VLOOKUP(O2:O,Sheet1!B:C,2,FALSE),""))

Resources