#NAME? Error with Google Sheets Pivot Table Calculated Field - google-sheets

I looked this issue up and did not find any sufficient solution for myself.
I am trying to create a Calculated Field through Google Sheets Pivot Tables and I'm getting the #NAME? error.
To my best understanding I'm following the steps given to create the Calculated Field correctly and no where can I find an explanation as to what I'm doing wrong.
Here is a sample of my spreadsheet (with private information removed):
https://docs.google.com/spreadsheets/d/1QCtZceVYFaPEWh57TrMLyFS8e7vGXunf7EWIEHZmCpo/edit?usp=sharing
I've gone through all the steps to verify that my method is correct. None of those column headers have any spaces in them, so I don't need the ' ' encasing each word.
What am I doing wrong? Please help.

I figured it out. Funny how the universe works. It's like as soon as I was willing to ask for help, the answer came to me :).
The column headers themselves were in a number format (Accounting to be specific). Because the values of those columns were intended to be dollar amounts, I formatted the entire column to Accounting. In doing so, the header (which contained text) also became formatted as an Accounting value.
Because of the headers were in a number format, the Calculated Field was unable to match the text to the value in the header. What this means: When creating a Calculated Field with Google Sheets Pivot Tables, the values being entered are explicitly defined (and matched accordingly) by Google Sheets. Text is probably actually looked at as a string type where as numbers are looked at as numbers (which makes sense of course).
Solution: I changed the headers to a text format and the calculated field no longer threw the #NAME? error! Yay :)

Related

How do add a Percentage column to this Google Sheet pivot table

I have a pivot table, in Google Sheets, and want to add a percentage column.
EDIT: here is a link to a sample spreadsheet: https://docs.google.com/spreadsheets/d/12qyhOtKphW1iBWAOtfDHU1RdZRZ_Nq91eQtdghZzIyc/edit?usp=sharing
Below you can see the pivot table with the column (E) that I've manually added next to it, showing what I want to achieve, but as part of the pivot table, which is a simple:
E4=D4/C4
However, I have tried adding a Calculated Field under Values but can't work out the right formula; this didn't work:
='Checked In'/'Events'
nor did:
=D4/C4
I'm sure it's something simple, but I can't for the life of me work it out. Can anyone shine a light on what I'm doing wrong please?
Short Answer: Only use the column headers of the raw data and not the column headers of the other existing calculated fields.
Note: Since you have not shared a sample spreadsheet, I have made a sample data just to show the process.
Sample Raw Data
Creating a Pivot Table
Select the desired data to be added to the table which only includes the useful column headers (like the one selected in the sample raw data image).
Add a Calculated Field
To add a calculated field, look for the Values section in the Pivot table editor and click add (as shown above). To enter a formula, the pivot table editor requires you to use the column headers instead of the cell range (A1 notation). The formula you provided works just fine. In this case, I used ='Checked in'/Events to check if column headers with one word do not necessarily need single quotation marks (which will result in the following):
Note: Always use 'string' (single quotation mark) format in using column headers especially when the column headers contain spaces (like Checked in in the example).
Note: You may change the Column Header Output just by selecting the cell and renaming it.
Sample Modifications
You may also use other Google Sheets functions in the formula just like:
Which results to:
Reference
Create & Use Pivot Tables
Additional Info
When trying to add additional calculated fields using data based from other calculated fields, always use the original column headers of the raw data and not the column headers of the calculated fields as it returns an error just like the one below:
In your case, I modified your formula to
=COUNTA('Venue Name')/COUNTUNIQUE('Event Date')
Since both Venue Name and Event Date are the column headers of your raw data and not Checked in and Events. The current output of the corrected formula should look like this:
To address the decimals in the output values, you may refer to the Sample Modifications section of this answer.

Is there a way to use ARRAYFORMULA to find the most-recent even input of a column?

SOLVED EDIT
Thank you for the help. Solution here.
ORIGINAL POST
I have made a google sheet to describe the issue I am facing linked here (https://docs.google.com/spreadsheets/d/1yK6ZAX8BFnEqiuQO9HIxuY0l62ewDDccj-8EN1r2i2w/edit?usp=sharing).
I will also describe in words, below, the problem I am facing, along with the solutions I have tried.
The data of column A are random single-digit (0-9). I would like column B to show the most recent even number from column A, but only up to a specific row. That specific row is the row corresponding to the row of the cell in column B. In other words, in cell B7, I want to find the most recently entered even number of column A, specifically only on the range A2:A7 (A1 contains a column header).
This is actually a pretty simple formula, and I can get the desired outputs by simply checking if the value in a cell in column A is even and then returning the value of that cell if it is, or the output of the cell above if it isn't. So the formula would look something like: ​=IF(ISEVEN(A7),A7,B6)​
However, my problem is that the length of the data in column A will be growing as more data are entered, and my current solution of using the fill handle to copy the formula to new cells is inelegant and time-consuming. So my desired solution is to use an array formula entered into the first cell of column B (B2), capable of returning the same value as the other formula. The formula I tried to enter to perform this was the following: ​=ARRAYFORMULA(IF(ISEVEN(A2:A),A2:A,INDIRECT(ADDRESS(ROW(A2:A)-1,2))))​
However, as some of my previous work with arrays has taught me, not all formulas iterate as expected down the array. The formula seems to be able to return the correct output on lines which are already even, but it is unable to return the expected most-recently entered even number for all the other lines. It appears that the formula is not able to appropriately interpret the ​value_if_false​ argument of the ​IF​ formula.
I'm a little new to scripting, so I'm still trying to learn, but I also tried to dabble around with custom functions to no avail. I'm still wet behind the ears when it comes to coding, which is why I've been so lenient on the built-in formulas of Google Sheets, but I fear I may have reached the limit of what Sheets formulas can do.
I am open to trying new approaches, but my only real constraint is that I would really like for this to be a one-touch (or even better no-touch) solution, hope that's not too far beyond the scope of this issue. Any assistance would be much appreciated.
EDIT
After rubber-ducking the problem here, I went back and tried to use the OFFSET formula, hoping I could get it to play nicely with the array formula. Alas, I was unable, but I thought I should at least post my progress here for reference.
Attempt with offset
Still working at it!
Doing a vlookup on the row number seems to work for me
=ArrayFormula(if(A2:A="","",vlookup(row(A2:A),{if(iseven(A2:A),row(A2:A)),A2:A},2)))
Note: if there are no even numbers in range for some rows, it will produce #N/A for those rows.

Query Importrange in Google Sheets Not Importing Correctly

We are using Google Forms to collect data on our students. They use the same Google Form for all students, but as part of the form, they are asked the students name.
The data that ends up being collected you can see on the tab Form Responses 1 on the Google Sheet linked here.
I am attempting to use ImportRange to create a tab for each of the students. The formula that I am using for just one of the students is...
=QUERY(IMPORTRANGE("1nJANDP1fiQunxfxEf-EjwJrnIRICv6kLhYYY9XBXtD4", "Form Responses 1!A:I"),"SELECT * WHERE Col3 = 'Adam N.'")
You can take a look at the tab called Adam N. and you'll see it is kind of working.
One thing that doesn't seem to be working is when there is a text value in columns E-I, that text value doesn't end up showing on the Adam N. tab. Any ideas how I can get both the numbers and the text values to show up?
The other thing that seems to be a problem is the fact that on the Adam N. tab, the very first row has the same headers as the Form Responses 1 tab, but it also has the very first line of data. Any way to remove that?
Importrange is not needed since you are 'importing' from within the same spreadsheet. Also, I'd recommend using the (optional) header argument in query().
It is often noted that users are tempted to mix data types within a column. The query() function will give undesirable output. If a column is intended for numeric values then only numerical values must reside in that column. Date columns must only contain dates and text columns only contain text values.
This does not mean that numbers cannot appear in a text column as long as they are in a text format. So it is important to plan the columns in a table to make sure this rule is maintained regardless if the data table is created manually or via submissions from a Google Form.
Generally, the query() function will assume the greater number of cell types in a column to be that data type. For example, if there are 100 numbers and 20 text values in the same column then a numeric value will be assumed for that column. There is a good chance the text values will just be ignored. One way to avoid this, would be to convert everything to text.
See if this works
=ArrayFormula(QUERY(to_text('Form Responses 1'!A:I),"WHERE Col3 = 'Adam N.'", 1))

Google Sheet Wildcard not working with COUNTIF

It should be simple, but it's not working. It seems like the same question as Google Spreadsheet, Count IF contains a string but it still doesn't work. And the semicolon mentioned in the responses of that question just gets eaten, so I'm guessing that's an old format.
Basically I have a column of years (it's not designated as a date column) and I want to return total decade counts. I put:
=COUNTIF(A1:A100, "200?")
I thought that would return a count value for everything from 2000-2009, but it just returns zero. If I remove the wildcard and make it one specific year, I do get a count for that year, so it's the wildcard that's the problem. I've tried "?" and "*" and neither work. What am I doing wrong here? Everything I've read says, including the Google COUNTIF documentation says this should work.
Screenshot of my spreadsheet formula
What am I doing wrong here?
You are misreading the documentation.
The documentation as referenced mentions wildcards only in the context If range contains text to check against,.
Number formats can however be changed to Text "on the fly" (ie within a formula), such as suggested by #TheMaster, or a different approach taken suited to the format, as in a Comment.

Exporting values of unchecked items in Google Forms checklist

Using Google Forms checkboxes to collect survey responses into a Sheets doc, I find that I can only get the values of checked lines to fill the spreadsheet.
I'm trying to get the unchecked CheckBox values to fill a different cell in the spreadsheet as well, has anyone found out a way to do this?
I'd appreciate any help!
I have a way with spreadsheet formulas.
The drawbacks are the necessities of
manual input of all possible options
copying and pasting a formula for each response (can be done in advance, but if not enough formulas are pasted for the number of responses, the sheet will break)
An ideal solution would automatically detect all possible responses, and could theoretically accept an infinite number of responses without breaking and needing maintenance.
With that said, he's an example of what I suggest:
Google Sheet
Google Form
All possible options on the form must be typed into cells A2:A
cells B2:B show comma+spaces if the corresponding cell in A2:A is not blank, with =arrayformula(if(isblank(A2:A),"",", ")). These commas and spaces are needed later in a concatenate().
Raw data from the Form Responses spreadsheet was brought into D2:E with =arrayformula('Form Responses 1'!A2:B)
G2:G holds the important formulas. They must be copied and pasted to each individual cell for each row.
First, all possible responses in $A$2:$B are filtered based on if the cell in column A can be found in the text in column E.
=filter($A$2:$B,arrayformula(iserror(search($A$2:$A,E2))))
Next, some error catching. I added an iferror() to catch a "N/A, no results found in filter evaluation", and an if(isblank(),"",) to catch if no timestamp is in column D meaning no response was recorded in this row.
=if(isblank(D2),"",iferror(filter($A$2:$B,arrayformula(iserror(search($A$2:$A,E2)))),""))
Finally, do a concatenate() to pull the values and the comma+spaces all into one string inside one cell.
=concatenate(if(isblank(D2),"",iferror(filter($A$2:$B,arrayformula(iserror(search($A$2:$A,E2)))),"")))
Oh, and if you don't like the comma+space being the last characters in the string, in J2:J I did a =arrayformula(iferror(left(H2:H,len(H2:H)-2),"")) which cuts off the last 2 characters of the string in column H.
If I come up with a better solution, I'll let you know. It's an interesting puzzle to solve.

Resources