Should I be trying to concatenate this data or is there a better way? & Help changing content from hard coded to dynamic [closed] - google-sheets

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 days ago.
Improve this question
https://docs.google.com/spreadsheets/d/1FqkXO8sdpeP9GPerdg8o2zcSiTV7o8gA-07iBvqw4Yw/edit#gid=1783566376
Attached is a workbook, currently the workbook functions just for Round Style pizzas only. Another user here created the formula used in Data!D1. What that formula is doing is taking the weight from column C, using the style from column b, and looking at the round table to find the closest match. for example - a 335 wt NY/Thin pizza displays as 15" because that's the closest size from the table on the round sheet.
What I would like to do is concatenate all of the styles so that colB on data includes everything from round and square & output the correct answer in C. I have a sneaking suspicion this is not an effective way to do this so please feel free to come at it from another direction.
One other thing:
On square - I have the following formulas in f1 and g1 respectively:
={"Detroit";ArrayFormula(IF(D2:D="","",$E2:$E*$D2:$D*$B2))}
={"Sicilian";ArrayFormula(IF(D2:D="","",$E2:$E*$D2:$D*$B3))}
The last value from B is hard coded - is there a way to dynamically generate that so when a new style is added to A & B is filled in - that the cells in row 1 don't have to be hard coded like that?
In the data sheet - I want people to be able to fill in any one of the round or square styles (I created named ranges), in the size sheet.

Following the process of your previous post, I added an IFERROR to did the same but with two columns joining with "X" in Square sheet. I understand your second expected value is not correct, but check it in my new column 😉
={"Size";MAP(B2:B,C2:C,LAMBDA(type,wt,SI(wt="","", IFERROR (SORTN(Round!D2:D,1,,BYROW(INDEX(Round!E2:Z,,XMATCH(type,Round!E1:1)),LAMBDA(d,ABS(wt-d))),1),JOIN("x",SORTN(Square!D2:E,1,,BYROW(INDEX(Square!F2:Z,,XMATCH(type,Square!F1:1)),LAMBDA(d,ABS(wt-d))),1))))))}
About being the best way or not, it will be depending upon you need it for further calculations or not

Related

Google Sheets: How to make a stacked/aggregate chart

I have made a bar chart which aggregates my data, but is there any way I can split each bar based on the data it is aggregating - similar to how a stacked bar chart would look?
Here is a bad artists impression (thick blue lines mine). The idea is that it's important to know from looking at the graph if I sold 5 at £1, or 1 at £5.
Ideally this would work even if the price for each item is variable, but that is not essential (eg: if there is a 'hack' with hardcoding Apple = 3, I can live with that.)
I'm also fine inputting helper columns etc, within reason, but I would want to be able to easily continue to add things to the list on the left without having to add new helper columns each time (calculated ones are fine, of course.)
Thanks in advance.
UPDATE: With thanks to Kin Siang below, I ended up implementing a slightly modified version of their solution, which I am posting here for completeness.
I added a very large (but finite) number of helper columns to the right, with a formula in each cell which would look for the nth occurrence of the item in the main list (wrapped in an iferror to make the unused cells blank).
=iferror(index(FILTER($A:$B,$A:$A=$D2),E$1,2))
Theoretically it could run out of space one day, but I have made it suitably large that this should not be an issue. It has the advantage over the other solution that I do not need to sort or otherwise manipulate the input range and can continue trickling in data to the main list and have the chart automatically update.
Yes, it is possible to display the chart in your case, however need some data transpose in order to do so, let me show you the example with dataset
Assuming this is your original data:
First sort the data by alphabet, and enter this formula in new column
=if(G39="",1,if(G40=G39,I39+1,if(G40<>G39,1)))
Next add new column for categorical purpose, by using concatenate function
="Price"&I40
In the transform data for chart purpose, enter this formula to split all price into different row, different column for different product
=sumifs($H$40:$H$47,$G$40:$G$47,$A41,$J$40:$J$47,B$40)
After that i select stack bar chart and ensure the price in under series, in case in 23 will have some problem to set price at series correctly, you can use 33 data create stack bar chart and update the data range again, it will work also
Here is the cute chart you expected, accept if help :)
*When certain fruit has less price record, it is advised to fill in 0, as the data table need in same column (see the orange price 3), although I didnot test if blank

How to create a multi-line graph from a pivot table in Google sheet? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have a pivot table which I couldn't generate a multi-line graph as desired.
How can I use this data to generate a lines-graph like this?
As can see in the image above, I couldn't create many colors, but only one line.
I want to have a drop down (or ability to filter by label) so x axis is day y axis is D column values and each domain has a different colored line.
In the pivot table, when a label doesn't have a row with some domain-value for some day it means domain has implicit 0% value for that label for that day. Can the graph deduce that without normalizing the pivot table?
From the question
I want to have a drop down (or ability to filter by label) so x axis is day y axis is D column values and each domain has a different colored line.
Try slicers. See the official docs : Filter charts and tables with Slicers
Another way to add a dropdown is to use cell validatition, but in this case you should use a formula or script that depends / will read the selected value. Again, please see the official docs: Create an in-cell dropdown list

Max Score then Offset Left one column

I am trying to find the max score and then offset left to find the name of the person that scored. However, the link below only allows for one column and one row at a time.
https://www.mrexcel.com/forum/excel-questions/472213-offset-formula-using-max-determine-reference-cell-location.html
This is not what I need. I need to have an equation that allows me to find the max score and then offset that to the left by one and take the name. I will need it for multiple columns and rows in the same equation that can be easy to read. I have come across equations like this.
ADDRESS(MAX((A154:H174=MAX(A154:H174))*ROW(154:174)),MAX((A154:H174)*COLUMN(A:H)))
Sorry for not having a picture I don't have enough reputation. It was a screenshot of my spreadsheet. Thanks for any help that you can provide.
I am open to suggestions and edits on this post. I do desire to improve and use this more often.
Try this, assuming your data is names in A1:A9 and the score in B1:B9
=INDEX(A1:A9,MATCH(MAX(B1:B9),B1:B9,0))

In Google Sheets, How do I find the row number of a cell with certain text in it?

In Google Sheets, What do I do if I want a cell to display the row number in which a certain word/line of text appears?
So, I'm working with two kinds of spreadsheets here: One has the number of "Competitors" (which I'm looking for) in the 7th row of the spreadsheet, while others might have it in a different row. To work around this inconsistency, I want to set up a cell function which outputs the row number of where ever the "Competitors" number is, and then concatenate that function into a reference for the correct row-number.
The tables that I'm looking in all have the labels in the first column
Here are some viewable links to the Sheets I'm working on:
https://docs.google.com/spreadsheets/d/1SS_Bk2FFGNnsxhhg3RQGflTSxEncAjD-CaQBtPjTIVM/edit?usp=sharing
https://docs.google.com/spreadsheets/d/1JJvbiYUYT3zb8OFwHoF1WaLmEGkwO4N7lLLeBqgWRcw/edit?usp=sharing
^Notice how "Competitors" is in row 7 in one sheet but in row 6 in the other. This is why I need to find a function which can find a reference to the row number of "Competitors"
Figured it out - To find the row numbers that the string "Competitors" was in, All I had to do was use the MATCH function like this:
=MATCH("Competitors", A:A,0)
The user #Jeeped told me about the "Match" function in a comment under his answer. Although Jeeped's answer did demonstrate the "MATCH" function, he presented it being used along side the "SUM" function, which confused me at first. Give thanks/upvotes to Jeeped for helping me find the solution in this :)

How to average the last seven values in a column?

I am trying to find the average of the seven most recent entries in a row, as seen in
this
spreadsheet.
I found a few questions similar to mine, but I am still pretty confused on how the answers work. The questions similar to mine can be found on the left side of my spreadsheet.
I think that the formulas would work for me with a few simple adjustments of which values to use, but I can't seem to figure it out. I would really appreciate if someone could explain one of the existing answers or come up with another one that works.
The spreadsheet is updated daily, so I need something that would continue to work as more and more data is added to the column.
Try:
=round(AVERAGE(OFFSET(H1,MAX(ARRAYFORMULA(ROW(H:H)*--(H:H<>"")))-7,,7)))
here's working sample
Explanation
We are getting the last non empty row: MAX(ARRAYFORMULA(ROW(H:H)*--(H:H<>"")))
Then with offset formula we are getting the range of last 7 cells in a column.
And then just use AVERAGE.
More info
You may find more info about finding the last non empty row here:
Selecting the last value of a column
Another way is to use INDEX and MATCH. The first match finds the position of the last number in the range and takes 6 away from it: the second match finds the position of the last number in the range. Passing it through the INDEX function gives a reference that you can use to give a range of 7 cells for AVERAGE to work on.
=average(index(H:H,match(999,H:H)-6):index(H:H,match(999,H:H)))
So my answer is like your Link2
The big snag here is if you have a text cell in the range (like "Nothing") it is much more difficult to work out which cell to start from to get an average of 7 cells. I think I know how to do it in Excel using OFFSET but offset doesn't seem to work in the same way in Google Sheets.
However I can see there is a solution to this in your Link3 which should work for you if you change A:A to H:H and SUM to AVERAGE. I have tested it on the average of the last ten cells which includes a "Nothing" cell:
=ArrayFormula(AVERAGE(QUERY(SORT(H:H,ROW(H:H)*ISNUMBER(H:H),0),"select * limit 10")))
and it gives the correct answer 61.8.
The way array formulas work in general is that instead of passing a single value to a function you pass a whole range or array (a list of values) and the function processes them one by one. The above formula takes the whole column H:H and sorts it on the row numbers in descending order but those cells which don't contain a number give zero in the multiplication and are sorted to the bottom. Then the query takes the top (in my case) 10 cells and passes them to AVERAGE.
BTW this doesn't have to be declared as an array formula: this also works
=AVERAGE(QUERY(SORT(H:H,ROW(H:H)*ISNUMBER(H:H),0),"select * limit 10"))

Resources