Related
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),
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))))
I'm trying to build a very simple inventory sheet. Apologies in advance, but I'm very new at this.
a) I'd like my inventory sheet to show stock for individual items, and for kits (BOMs)
b) I'd also like the array formula to update depending on an adjacent column value (i.e. if the row shows 'fulfilled' then the array should ignore it.
I have been able to modify an old post that I found here, but unfortunately the original document was modified. https://support.google.com/docs/thread/23230245?hl=en
Does anyone have access to that original doc? I know Matt King was involved.
Does anyone know of a beginner's guide to Google Sheets Query / Array formulas?
I know I'm speaking in gibberish, but believe me I'm fascinated with this and I'm a quick learner. Would also be interested in paid coaching if anyone's into that!
https://docs.google.com/spreadsheets/d/1btnxxI00qI9njIUzudAZXh4G87TWcHoWtfPl4jBl7jM/edit?usp=sharing
={"Units"; ArrayFormula(IFNA(VLOOKUP(B2:B, QUERY({'BOM Import'!F2:I},
"select Col1,sum(Col4)
where Col4 is not null
group by Col1
label sum(Col4)''"), 2, 0)))}
={"Total Stock on Hand"; ArrayFormula(IF("yes"=IFNA(VLOOKUP(IFNA(VLOOKUP(B2:B, {'BOM Import'!F2:F, 'BOM Import'!E2:E}, 2, 0)), SORTN(SORT({'Kits Requested'!B2:B, 'Kits Requested'!A2:D}, 2, 0), 9^9, 2, 3, 1), 5, 0)), 0,
IFNA(VLOOKUP(B2:B, QUERY({'BOM Import'!F2:J}, "select Col1,sum(Col5) where Col5 is not null group by Col1 label sum(Col5)''"), 2, 0))))}
I have a formula that allows me to join multiple rows together and remove duplicates:
=TEXTJOIN(" ", 1, UNIQUE(TRANSPOSE(FILTER(Sheet1!A:D, NOT(REGEXMATCH(LOWER(Sheet1!A:D), "n/a"))))))
The issue I'm running in to is because this references another tab in the same sheet, it cannot be sorted by different columns without changing the results.
So what I'd like to know is: how do I modify the above formula so that it pulls the data it needs based on criteria I give it? Note this will need to be across a range of cells and includes strings of text.
After your comment I understand what you are trying to do. Basically you want to retrieve an information of the first sheet matching with your "row key".
Is there any reason why you haven't used a VLOOKUP?
For example using this formula:
=IFNA(VLOOKUP(A1,Sheet1!A:G, 7, FALSE), "VALUE NOT FOUND")
If you sort or randomize the range of column B you get a result like this:
In here you see that every description keeps up with its key.
EDIT: So after your comment it seems that you don't have your information inside a single cell. You could create this cell as a placeholder to later retrieve the information.
Or if you need you could make this inside the formula, that could make this a little messy but still could be workable.
=TEXTJOIN(" ", 1,
UNIQUE(
TRANSPOSE(
FILTER({VLOOKUP(A1, Sheet1!A:G, 3, FALSE), VLOOKUP(A1, Sheet1!A:G, 4, FALSE), VLOOKUP(A1, Sheet1!A:G, 5, FALSE), VLOOKUP(A1, Sheet1!A:G, 6, FALSE)},
NOT(LOWER({VLOOKUP(A1, Sheet1!A:G, 3, FALSE), VLOOKUP(A1, Sheet1!A:G, 4, FALSE), VLOOKUP(A1, Sheet1!A:G, 5, FALSE), VLOOKUP(A1, Sheet1!A:G, 6, FALSE)}) = "n/a")
)
)
)
)
try:
=ARRAYFORMULA(IFNA(VLOOKUP(TO_TEXT(B1:B), {QUERY(TRANSPOSE(QUERY(QUERY(
UNIQUE(TRIM(SPLIT(TRANSPOSE(SPLIT(QUERY(TRANSPOSE(QUERY(TRANSPOSE(
IF(Sheet1!C:E="",,"♥"&ROW(Sheet1!C:C)&"♦"&Sheet1!C:E)),,999^99)),,999^99), "♥")), "♦"))),
"where not lower(Col2) matches 'n/a'", 0),
"select max(Col2) group by Col2 pivot Col1")), "select Col1", 0), TRANSPOSE(QUERY(QUERY(
QUERY(QUERY(UNIQUE(TRIM(SPLIT(TRANSPOSE(SPLIT(QUERY(TRANSPOSE(QUERY(TRANSPOSE(
IF(Sheet1!C:E="",,"♥"&ROW(Sheet1!C:C)&"♦"&Sheet1!C:E)),,999^99)),,999^99), "♥")), "♦"))),
"where not lower(Col2) matches 'n/a'", 0),
"select max(Col2) group by Col2 pivot Col1"), "offset 1", 0),,999^99))}, 2, 0)))
I have this formula for counting matches in Contents!$B$2 in J4.
=ARRAYFORMULA(IF(NOT(REGEXMATCH(J4,
"\w")),0,SUM(COUNTIF(REGEXREPLACE(SPLIT(J4,","),"
[\s]",""),REGEXREPLACE(SPLIT(Contents!$B$2,","),"[\s]","")))))
The formula is in K4 but ideally, I want it to work right down J returning values to the relevant adjacent K. I tried this but it didn't work. Just filled the cell the formula was in
=ARRAYFORMULA(IF(NOT(REGEXMATCH(J4:J,
"\w")),0,SUM(COUNTIF(REGEXREPLACE(SPLIT(J4:J,","),"
[\s]",""),REGEXREPLACE(SPLIT(Contents!$B$2,","),"[\s]","")))))
I know I can just fill down but the issue is users inserting rows.
Thanks in advance for any assistance
=ARRAYFORMULA(IF(LEN(A2:A), IFERROR(VLOOKUP(A2:A,
QUERY(TRIM(TRANSPOSE(SPLIT(Contents!B1, ","))),
"select Col1,count(Col1) group by Col1", 0), 2, 0), 0), ))