How to combine dynamic ranges with OFFSET and INDIRECT functions? - google-sheets

I'm trying to create a formula that uses a dynamic range to link to the different tabs. It would then return the last 12 values before a blank cell, based on the value in the Header Column.
The tricky part is the data in each tab is of different sizes, so I thought it might have to incorporate either Offset(Blank()),0,-12) or something of the sort. I've tried a lot of different things, and this is the latest effort:
=Index(Indirect(A2&"!A9:AK9"),match("Conversions",Indirect(A2&"!A9:AK9"),)0,-12)
Edit: First post, sorry for the confusion. My goal is to make a large dashboard that has a dynamic chart using our monthly metrics. (I'm leaving the chart setup for another day)
The data varies in such, some have columns A:K, while some have a larger range of A:AK , etc. (With A:A being text). Since I've posted this, I have had some success by using Filter(), but the problem I'm not sure how to solve is finding the last 12 values before a blank cell.
Example of Data 1
Example of Data 2
Hopefully this helps explain the situation and I appreciate everyone for help.

Related

Transform comma separated google form answers to multiple lines in spreadsheet

I have made a google form to which some answers are formatted as comma separated strings inside the automatically populated google spreadsheet. I would like to read from this sheet to another sheet and reformat the answers so that each comma separated answer is shown on a new row. I have tried to apply an ARRAYFORMULA that reads from the original sheet and then use a solution that uses SPLIT and TRANSPOSE the cell content, however combined with the ARRAYFORMULA this fails since it would overwrite contents in other cells.
Here is an example spreadsheet with the responses, a solution sheet, and a desired results sheet. https://docs.google.com/spreadsheets/d/1r_l5fVJ9lGfpubO2o3pXicV7JlZWmANjwSgNi7_DL0A
Any suggestions for how I can achieve the end result?
Okay, I assume this isn't really what you want, but visually it looks okay...
Try this formula:
={{'Form responses'!A2:A3},ArrayFormula(regexreplace('Form responses'!B2:E3,", ",CHAR(10)))}
Then format the cells so that the cell contents are TOP-aligned, instead of the default BOTTOM-aligned.
Realistically, I imagine that you want each question answer split into multiple cells. But if your data responses really contain letter values separated by commas, as you've indicated, you can still search through those cells to find whether an answer contains a certain value. It all depends on why you want the results structured the way you do.
If you can clarify what you want to do with the form results, instead of just appearing vertically for each question, perhaps we can provide a full solution for that requirement?
UPDATE1:
Okay, I may be getting close. I can get your data transformed to look like the following:
This would let you do the analysis that you want, by searching for Q.1 (question 1 responses) in the first column, and then all the answers in the third column, along with the owner in column 2. And from this, it will also definitely be possible to put the results in the exact form you want. It just may take an intermediate step.
UPDATE2:
Okay, I think I have something you can use. I can convert your data to either of the following two layouts.
The one on the right is closest to what you asked for, with the exception that the answers on the right are bottom aligned, with blanks above. But you can still process them for analysis, with queries. I honestly think having the user identifier (email address) on each row would make things simpler, but I can provide it either way.
The layout on the left is more of a traditional database layout, and would make analysis very simple. Each row has the date and email identifiers, the question number, and the answer (or one of the answers) to that question, from that user.
If this is helpful, it might be best if you enabled your sample sheet to allow us to edit it, to enable me to implement it in your sheet. But here is my sample sheet, in case anyone wants to look through it. Note that the main formula to reformat the data, in Solution!B3, could benefit from a lot of cleanup, and is probably nowhere near the best way to achieve this. Just throwing up one possible solution...
I'll try to add some explantion for the formula at some point, but ask if you have any questions.

How do I use Number Formatting in Google Sheets to display an UNSIMPLIFIED, NON-reduced fraction?

I'm building a progress tracking worksheet at the moment. I use Checkboxes to mark tasks as complete, and I have a simple formula to check "how many are done (true)" / "how many there are".
=COUNTIF(M7:Z7,TRUE)/(COUNTA(M7:Z7))
This was successful, and got me the percentages I needed for my progress bars, but it wasn't as useful as I was hoping because I realized I wanted to keep track of the precise quantity of remaining items in addition to the total completion rate.
So I did some digging and found the custom number formatting options in sheets, and was able to use this format to change my calculation into a non-mixed fraction:
_# ??/??
So THAT worked just fine until I realized it was treating it like, well, an actual fraction and trying to simplify it all the time. I don't want to know that I've done 1/7th of the things, I want to know that I have done 2 out of 14 things.
The reason I noticed this problem in the first place is because when it hit "100%" for one of the task categories, it went from "13/14" to just the whole number "1," which is the opposite of what I want; I want it to still show the fraction, as "14/14."
I feel like I've been spinning my wheels for so long now, I'm not sure how much better to do this WITHOUT having to completely restructure my sheet and formulas and add some stupid hidden math columns in between what I already have built.
Ideal solutions would just be some secret in the Number Formatting options. But I absolutely cannot use a static denominator in the number formatting. At this point I'm not sure what kinds of other options there are to be honest.
tl;dr
In Google Sheets, what's the best way to display an unsimplified fraction with a non-static Numerator and Denominator?
If what you want is to visualize the fraction, but not use it for further calculations. You could simply display is as a string.
For example:
this: =COUNTIF(M7:Z7,TRUE)/(COUNTA(M7:Z7))
becomes
this: =COUNTIF(M7:Z7,TRUE)&"/"&COUNTA(M7:Z7)
Note:
Keep in mind COUNTA counts all the values in the range, not just the number of rows (Which I assume is the number of tasks).
You may want to change the range passed to COUNTA to be a single column.

Creating Dynamic Sheet Cell Reference List for pulling numbers to SUM

I've been working on building a data analysis sheet, which is quite verbose at the moment and a bit more complicated than it should be as I've been trying to figure this out. Please note, I work doing student data in a school.
Basically, I have two sets of input data:
Data imported from a CSV file that includes test data and codes for Common Core Standards and the questions tied to those standards as a whole class summary
Data imported from a CSV file that includes individual scores by question
I am looking to construct 2 views:
A view that collates and displays data of individual standards per student that includes a dropdown to change the standard allowing a teacher to see class performance by standard in a broad view. The drop-down is populated dynamically from the input data (so staff could eventually dump data and go directly to reports)
A view that collates and displays data of individual students broken down by performance on each standard allowing a teachers to see the broader spectrum for each student. The student drop-down is populated from Source list 2.
I have been able to build the first view, but am struggling with the second. I've been able to separate the question codes and develop strings of cell references to the scoring data, including a dynamic reference to the row the selected student's score data appears on in the second source set from above.
I tried to pass through an indirect() formula into a sum() so as to process for a mean evaluation, and have encountered errors. I think SUM() doesn't process comma-separated cell reference lists from Indirect() [or in general] or there is something that I am missing to help parse it. Here is the formula I have tried:
=Sum(vlookup(D7,CCCodeManip!$A:$C,3,false))
CCCodeManip!C:C includes the created text (based on the dynamic standards and question codes, etc), here's an example of what would be found there:
'M-ADI'!M17, 'M-ADI'!N17, 'M-ADI'!O17, 'M-ADI'!P17, 'M-ADI'!Q17, 'M-ADI'!R17, 'M-ADI'!J17
I need these to be dynamic so that teachers can input different sets of standards, question, and student data and the sheet automatically collates and reports it in uniform ways (with an upward bound of 20 standards as I currently have it built)
Here is a link to the sheet I built, with names and ID anonymized. There's a CRAP TON of sub-tabs, and that's really just being able to split apart and re-combine data neatly without things error-ing out due to data overlapping, aside from a few different attempts and different approaches to parse the cell reference strings.
The first two tabs are the current status of the data views. I plan to hide a bunch of the functional stuff that is there to help pull data accurately.
The 3rd and 4th tab are the source data sets. 5th is a modified version of source data that allows me to reference things better, and I've tried to arrange the sheets most relevant towards the front of the set.
https://docs.google.com/spreadsheets/d/1fR_2n60lenxkvjZSzp2VDGyTUO6l-3wzwaV4P-IQ_5Y/edit?usp=sharing
Some have a different approach? I am aware that I might be as far as I cn go with this and perhaps should consider scripts - my coding experience is a bit out of date and my strength is more with the formulas, but I can dig into things with some direction, if anyone can help.
Ok so I noticed something.
It seems the failure is in the indirect reference:
=indirect(CCCodeManip!C3)
The string I am trying to parse via indirect is going to be generated into something like this, dynamic from reference to other data:
'M-ADI'!M17, 'M-ADI'!N17, 'M-ADI'!O17, 'M-ADI'!P17, 'M-ADI'!Q17, 'M-ADI'!R17, 'M-ADI'!J17
The indirect returns the error that the above string is not a cell reference with the #REF code.
Can someone give me a clue as to what is causing this? I am going to dig into the docs on Indirect() from google and will post anything that I find.
Perhaps it is that indirect() can't handle lists, but only specific references and arrays, which may require me a to build a sheet to do the SUM formula on for each question set (?)
So I think I figured it out, but i Ended up parsing the data differently, basically doing the sum based on individual cell references and a separate sum formula, bypassing the need to do it all at once, it jsut makes my sheets a lot dirtier! I am eventually going to see if code could do it better if I need to, but this is closed for now.
Basically, I did individual cell references to recall scores in a row, then used a separate SUM formula, and created references / structures to be able to pull those sum() results. Achieves the same end, but with extra crap on the sheet.

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.

Conditional formatting based on multiple criteria

I don't know if what I wrote in the title is specific enough to what I'm looking for, anyway, I'll try and explain as much as possible here.
I have two sheets, one is the layout, the other is the database.
The layout is a layout of computers in an office, and in the database I have various information about those computers (e.g. manufacturer, processor, etc).
What I'm looking for is a way to change the colors of the cells in the layout sheet based on the data in the 'db' sheet.
This is the first sheet, where numbers are the ID's of the computers.
On the second sheet, I have more information about each number.
This is from the second sheet, the 'db' sheet.
What I'm trying to do here is change the colors of the cells in the first sheet based on information on the second sheet and based on the dropdown selected.
For example, in the pictures above, I have chosen 'computer' which needs to change the color of the cells based on the manufacturer given in the second sheet.
I would've posted a formula that I'm currently working on, but the problem is I'm very new to conditional formatting and currently am completely stumped on this problem.
Thanks in advance.
This might not be exactly what you're looking for but it's on the right path. I'm not sure if "Dell" and "HP" are supposed to be dynamic results of the data validation or? Either way...
=AND(VLOOKUP(C2:C,INDIRECT("Sheet2!A2:B"),1)=C2:C,VLOOKUP(C2:C,INDIRECT("Sheet2!A2:B"),2)="Dell",$D$3="computer")
and
=AND(VLOOKUP(C2:C,INDIRECT("Sheet2!A2:B"),1)=C2:C,VLOOKUP(C2:C,INDIRECT("Sheet2!A2:B"),2)="HP",$D$3="computer")
Be sure to reference C:K in the Conditional Formatting Rules. That way you can avoid having to repeat the process for each column.

Resources