GSheets Forumula Stalls on Tie Score Number - google-sheets

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))

Related

Finding Cheapest Flights

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, )

Data mapping between two sheets

I am looking for a formula based solution to map information from one sheet that is imported using IMPORTRANGE to another sheet (what a bad explanation). But an example might be easier to understand - the following two sheets are given:
Sheet 1
Color
Formula column
red
=???
green
=???
blue
=???
Sheet 2 (imported from another file with IMPORTRANGE)
color
details1
details2
peter
susan
john
christin
red
not important
not important either
1
0
0
1
green
not important
not important either
1
1
0
0
And this is what I want the result should look like
Sheet 1 (expected)
Color
Formula column
red
peter, christin
green
peter, susan
blue
nobody
Sadly, I am not really good with the formula stuff. I've created an Apps Script but since the lookup data in sheet two has more than 1000 rows it always ends up in a exectuion timeout.
use:
=BYROW(A2:A,LAMBDA(ax,if(ax="",,IFERROR(JOIN(", ",query({LAMBDA(bez,QUERY(INDEX(SPLIT(FLATTEN({importrange(bez,"Sheet2!A2:A")&"|"&importrange(bez,"Sheet2!D1:G1")&"|"&importrange(bez,"Sheet2!D2:G")}),"|",0,0)),"Select * Where Col1!='' AND Col3=1"))("[SHEET 2 SPREADSHEET ID]")},"select Col2 Where Col1='"&ax&"'")),"nobody"))))
Replace [SHEET 2 SPREADSHEET ID] in the formula with the relevant sheet ID
try:
=INDEX(IFNA(VLOOKUP(A7:A10, LAMBDA(x, {OFFSET(x, 1,, 9^9, 1 ),
BYROW(IF(OFFSET(x, 1, 3, 9^9, 4)*1=1, OFFSET(x,, 3, 1, 4), ),
LAMBDA(y, TEXTJOIN(", ", 1, y)))})(A1:G5), 2, )))

Find the row name with the highest sum of numbers

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),

Display Upcoming Dates By This Week, Next Week and Next Month on a separate sheet

I am new to google sheets. I have a spreadsheet with all my data and im trying to build a dashboard for easy digestion for my team. Part of the data is keeping track of our filming dates for each client. From shoot one up to shoot 4, so 4 columns of dates. What I want to do is have any of those dates that fall into "This Week" to be displayed in a column on another sheet titled the same thing. Followed by a column with "Next Week" and "Next Month" so that I can see at a glance all the upcoming shoot days. Quite simply I have no idea how to do this.
Another aspect of it is that I also want the first 2 columns of the data sheet to display next to the date in the dashboard sheet as well as this holds the client name and project name. The first 2 columns being '2022'!A3:B and the list of dates being '2022'!S3:V.
Any help or guidance will be massively appreciated!
I have tried using an Array Formula and Filter formula but am struggling to know what to search to find the answer I need so have come on here for some help.
this week:
=ARRAYFORMULA(ARRAY_CONSTRAIN(QUERY(SPLIT(FLATTEN(
IF('2022'!S3:V="",,'2022'!A3:A&"×"&'2022'!B3:B&"×"&TEXT('2022'!S3:V,
"dd/mm/yy\×dddd")&"×"&WEEKNUM('2022'!S3:V, 2)&"×"&'2022'!C3:C)), "×"),
"where Col6 matches 'ACTIVE|ENQUIRY'
and Col5 = "&WEEKNUM(TODAY(), 2)), 9^9, 4))
next week:
=ARRAYFORMULA(ARRAY_CONSTRAIN(QUERY(SPLIT(FLATTEN(
IF('2022'!S3:V="",,'2022'!A3:A&"×"&'2022'!B3:B&"×"&TEXT('2022'!S3:V,
"dd/mm/yy\×dddd")&"×"&WEEKNUM('2022'!S3:V, 2)&"×"&'2022'!C3:C)), "×"),
"where Col6 matches 'ACTIVE|ENQUIRY'
and Col5 = "&IF(WEEKNUM(TODAY(), 2)+1>WEEKNUM(DATE(YEAR(TODAY()), 12, 31), 2), 1,
WEEKNUM(TODAY(), 2)+1)), 9^9, 4))
next month:
=ARRAYFORMULA(ARRAY_CONSTRAIN(QUERY(SPLIT(FLATTEN(
IF('2022'!S3:V="",,'2022'!A3:A&"×"&'2022'!B3:B&"×"&TEXT('2022'!S3:V,
"dd/mm/yy\×dddd")&"×"&MONTH('2022'!S3:V)&"×"&'2022'!C3:C)), "×"),
"where Col6 matches 'ACTIVE|ENQUIRY'
and Col5 = "&MONTH(EOMONTH(TODAY(), 1))), 9^9, 4))
demo sheet

Is it possible to get a particular row cell value using a formula that combines both row and column searches?

I am setting up a shift roster. The top row is sequential dates, and the leftmost rows are staff names. A staff member can look along their row to see which shifts they are on for the coming weeks.
I want to automatically pull out the allocated shifts into another sheet to show a dynamic "Today's Staffing" which shows who is on duty in each role for the day e.g. for column TODAY'S DATE find which row contains MORNING SHIFT and return the FIRST COLUMN FOR THAT ROW which should contain the name.
I have access to both MS Excel and Google Sheets.
Is there a function/way that I can do this?
Example google sheet:
https://docs.google.com/spreadsheets/d/1VTYK39xuHT0-4s8O5398dnseXYsE0q54-os-rJNNVB8/edit?usp=sharing
=QUERY({INDIRECT(ADDRESS(2, MATCH(TODAY(), A1:1, 0), 4)&":"&
SUBSTITUTE(ADDRESS(1, MATCH(TODAY(), A1:1, 0), 4), 1, )), A2:A},
"where Col1 <>'OFF' and Col1 <>''")
if you want to run this under with just 3 people do:
=QUERY({INDIRECT(ADDRESS(2, MATCH(TODAY(), Sheet1!A1:1, 0), 4)&":"&
SUBSTITUTE(ADDRESS(4, MATCH(TODAY(), Sheet1!A1:1, 0), 4), 1, )), Sheet1!A2:A4},
"where Col1 <>'OFF' and Col1 <>'' order by Col1 desc")

Resources