Is there anyway in which I can first sort the data date wise and then remove the duplicate names for the same day.
try:
=ARRAY_CONSTRAIN(SORTN({A2:C, B2:B&A2:A}, 9^9, 2, 4, 0, 2, 1), 9^9, 3)
Related
Link to view-only sheet.Looking to find the cheapest flight plan between two points. There’s additional information on the sheet.
Available flights are of the form:
From
To
Price
Airport1
Airport2
100$
Airport2
Airport3
500$
Sample data with an intended output can be found on the sheet.
try:
=QUERY(SORTN(QUERY(SORT(A2:C6, 1, 1, 2, 1, 3, 1),
"where Col1<Col2", ), 9^9, 2, 1, 1),
"where Col1 >="&F1&" and Col2 <="&F2, )
In the below spreadsheet, I am trying to find the item with the highest total sales across various hours.
I would like to easily extract the highest and lowest selling item names as well as their corresponding total sales. I need to be able to do this without creating a helper column as I cannot edit the table.
I know there's probably an easy way to do this but for the life of me I cannot figure it out!
Link to Sheet
B12:
=INDEX(SORT(SPLIT(FLATTEN(B2:G10&"×"&A2:A10&"×"&B1:G1), "×"), 1, 0), 1, 2)
B13:
=INDEX(SORT(SPLIT(FLATTEN(B2:G10&"×"&A2:A10&"×"&B1:G1), "×"), 1, 0), 1, 1)
B14:
=INDEX(SORT(SPLIT(FLATTEN(B2:G10&"×"&A2:A10&"×"&B1:G1), "×"), 1, 1), 1, 2)
B15:
=INDEX(SORT(SPLIT(FLATTEN(B2:G10&"×"&A2:A10&"×"&B1:G1), "×"), 1, 1), 1, 1)
** edit: use player0's for the overall min and max.
Check this demo sheet
To get the highest or lowest by time slot (put this in I5),
=ARRAYFORMULA(
IFERROR(
VLOOKUP(
TRANSPOSE(B1:G1),
SORT(
SPLIT(
FLATTEN(B1:G1&"|"&A2:A&"|"&B2:G),
"|"),
3,FALSE),
{1,2,3},FALSE)))
Then to align the lowest per timeslot with that, put this in M5
=ARRAYFORMULA(
IF(ISBLANK(I5:I),,
IFERROR(
VLOOKUP(
I5:I,
SORT(
SPLIT(
FLATTEN(B1:G1&"|"&A2:A&"|"&B2:G),
"|"),
3,FALSE),
{2,3},FALSE))))
If you also wanted conditional formatting for the daily high and low, use a range of B2:G with
=AND(LEN(B2),MIN($B2:$G2)=B2)
If you really want to have these formulas below the table, change
FLATTEN(B1:G1&"|"&A2:A&"|"&B2:G),
to
FLATTEN(B1:G1&"|"&A2:A10&"|"&B2:G10),
Background Information
I am trying to setup a 1st, 2nd and 3rd rank/scoring system on Google Sheets. The sheet is setup by row and once a week a new row is added.
1. On the left-hand side of each row there are six columns. The top of each column is a cell that contains the value identifier for that column (such as a person's name or ID#). Each week the score is entered into each column.
2. The right-hand side of each row is to identify the 1st, 2nd and 3rd place winners. This area also contains six columns with the headers 1st, 2nd, 3rd. I'm trying to set it up so that each week when the new numbers are added to the next row, the relevant score is shown and the cell next to it shows the name/ID associated with that week's score. Then repeat for 2nd and 3rd.
Problem
Everything works perfectly; unless there is a tie. In that situation the information is duplicated because it stalls on the first match. I have attempted various things, including using "RANK()" and a helper column to eliminate duplicate scores, but as of yet this has me stumped. How can this be solved?
To illustrate what I am trying to do, I have an editable example sheet here:
https://docs.google.com/spreadsheets/d/1bmt77kQOtCu8OybNrWH48XKjBKD_HEZ_B6TqweZKEAI/edit?usp=sharing
use in J6:
=ARRAYFORMULA(ARRAY_CONSTRAIN(SORTN(SORT(SPLIT(
FLATTEN(D6:I*1&"×"&D5:I5&"×"&ROW(D6:D)), "×"),
3, 1, 1, 0), 9^9, 2, 3, 1), COUNTA(B6:B), 2))
in L6:
=ARRAYFORMULA(ARRAY_CONSTRAIN(SORTN(QUERY(QUERY(SORT(SPLIT(
FLATTEN(D6:I*1&"×"&D5:I5&"×"&ROW(D6:D)), "×"), 3, 1, 1, 0), "offset 1", ),
"skipping "&COUNTA(D5:I5), ), 9^9, 2, 3, 1), COUNTA(B6:B), 2))
in N6:
=ARRAYFORMULA(ARRAY_CONSTRAIN(SORTN(QUERY(QUERY(SORT(SPLIT(
FLATTEN(D6:I*1&"×"&D5:I5&"×"&ROW(D6:D)), "×"), 3, 1, 1, 0), "offset 2", ),
"skipping "&COUNTA(D5:I5), ), 9^9, 2, 3, 1), COUNTA(B6:B), 2))
I want to calculate Relative Strength Index that use the sum of 14 day of Gains.
I can use SUM function then drag down to the bottom, but I want it to expand infinitely (H16 to H).
Is there any way to use ARRAYFORMULA? or I must use appscript?
I try many things and can't figure the way out.
try:
=INDEX(IF(SEQUENCE(MATCH(9, 1/(G3:G<>"")))<16,,
MMULT(N(IFERROR(SPLIT(REGEXEXTRACT(" "&trim(FLATTEN(QUERY(TRANSPOSE(IF(
SEQUENCE(MATCH(9, 1/(G3:G<>"")))>=SEQUENCE(1, MATCH(9, 1/(G3:G<>""))),
TRANSPOSE(INDIRECT("G3:G"&MATCH(9, 1/(G:G<>"")))), )),,9^9))),
REPT(" -?\d+(?:\.\d+)?", 14)&"$"), " "))), SEQUENCE(14, 1, 1, 0))))
try:
=ARRAYFORMULA(IF(SEQUENCE(COUNTA(G3:G))<14,,
MMULT(IFERROR(VLOOKUP(ROW(G3:G)-SEQUENCE(1, 14, 0),
{ROW(G3:G), G3:G}, 2, )*1, 0), SEQUENCE(14, 1, 1, 0))))
How can I compare between A and E and If matches then put the difference in I?
=ARRAYFORMULA(IF(LEN(I4:I),
IFERROR(VLOOKUP(I4:I, E4:F, 2, 0))-
IFERROR(VLOOKUP(I4:I, A4:B, 2, 0)), ))