So I have a spreadsheet with a very long series of numbers in a single column. I'd like to have a second column next to it that shows the lowest value contained in the first column, excluding any rows above.
Right now I've accomplished this by using a formula in each row of the second column [ ie: =MIN($I2:I) ], but I'd rather avoid having a formula in every row. Is there a way to accomplish this using a single Array Formula?
=ARRAYFORMULA(QUERY(TRANSPOSE(QUERY(TRANSPOSE(ARRAY_CONSTRAIN(SPLIT({"";
REPT("×99999", ROW(INDIRECT("A1:A"&COUNTA(A1:A)-1)))}&"×"&TEXTJOIN("×", 1,
INDEX(SORT({INDIRECT("A1:A"&COUNTA(A1:A)), ROW(INDIRECT("A1:A"&COUNTA(A1:A)))}, 2, 0)
,,1)), "×"), COUNTA(A1:A), COUNTA(A1:A))), "select "&TEXTJOIN(",", 1, IF(LEN(A1:A),
"min(Col"&ROW(A1:A)&")", ))&"")), "select Col2"))
spreadsheet demo
Related
In the below spreadsheet, I am trying to find the bar with the highest sales per show. So I want the formula in cell B2 on the 'FRONT SHEET' to look at the 'BAR SALES' sheet and find the specific show, find the highest sales in that row, and then pull the bar name.
I am currently using this formula which works; however, the formula is specific to this show. I want the formula to be broader and be able to search for the show in the 'BAR SALES' sheet.
=INDEX('BAR SALES'!$B$1:$F$1,MATCH(MAX('BAR SALES'!B2:F2,'BAR SALES'!B2:F2),'BAR SALES'!B2:F2,0))
This is a dummy spreadsheet but has the gist. My actual sheet is a lot bigger so I want to be able to search a long list of shows for this information without specifically tailoring the formula to each show in that list. Can I add a vlookup in this formula somehow??
[https://docs.google.com/spreadsheets/d/1dcjjQyZj9ANUTyTMloiY2CX94nBSYLt5hCiSWzY3tBk/edit#gid=1376876918][1]
use:
=ARRAYFORMULA(IFNA(VLOOKUP(A2:A, SORTN(SORT(SPLIT(
FLATTEN('BAR SALES'!A2:A&"×"&'BAR SALES'!B1:F1&"×"&'BAR SALES'!B2:F),
"×"), 3, 0), 9^9, 2, 1, 1), 2, 0)))
This is a slightly longer version of #player0's. Either will return the same response. They both do a FLATTEN and then a SPLIT to generate three columns. Test each out with your data to see if either is faster. They should be roughly the same, but its worth testing.
=ARRAYFORMULA(
IF(ISBLANK(A2:A),,
IFERROR(
VLOOKUP(
A2:A,
QUERY(
SPLIT(
FLATTEN(
IF(ISBLANK('BAR SALES'!A2:A),,
'BAR SALES'!A2:A&"|"&'BAR SALES'!B1:F1&"|"&'BAR SALES'!B2:F)),
"|"),
"where Col3 is not null
order by Col3 desc"),
2,FALSE))))
I have some simple data in the following format:
I need to make a sum of the last column, but based on the text in Domain column. The resulting table should be like this...given the text filtering needed, I'm not using pivot tables.
To do this, for July Domain 1 for example, I have a formula like this:
=SUMIFS(C:C, MONTH(A:A), 7, B:B, "domain1.")
And for the rest of the domains:
=SUMIFS(C:C, MONTH(A:A), 7, B:B, "<>domain1.")
I am using SUMIFS because I need the multiple conditionals. But this formula above gives an error:
Error: Array arguments to SUMIFS are of different size.
The columns are all structured as A:A, B:B, etc. What is going wrong?
Thanks.
MONTH(A:A)
will output only one cell unless you wrap your formula into INDEX or ARRAYFORMULA:
=INDEX(SUMIFS(C:C, MONTH(A:A), 7, B:B, "<>domain1.*"))
=ARRAYFORMULA(QUERY({TEXT(A2:A, "mmmm"), B2:C},
"select Col1,sum(Col3)
where not Col2 contains 'domain1.'
and Col3 is not null
group by Col1
label sum(Col3)''"))
I'm not sure why I can't find examples of this.
But I want my column E to have an average of all the columns to the right. In single example it's:
=AVERAGE(F2:O2)
Now I try to do this for the whole column:
=ArrayFormula(IF(ROW(E:E)=1,"Aggregate",AVERAGE(F:O)))
The problem is it doesn't do it per row, it just does the whole array. Maybe i don't want to use ArrayFormula
I should also put a IF(ISBLANK(F (Row())), "" So I don't calculate blank rows.
How do I put dynamic row on this?
try:
=ARRAYFORMULA(QUERY(TRANSPOSE(QUERY(TRANSPOSE(F2:O),
"select "&TEXTJOIN(",", 1,
IF(TRIM(TRANSPOSE(QUERY(TRANSPOSE(F2:O),,99^99)))<>"",
"avg(Col"&ROW(F2:F)-ROW(F2)+1&")", ))&"")),
"select Col2"))
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")
In a Google sheet with form responses, I made an additional column where I want to look up from each submission if the value left of my new column already occurs in a range on another sheet.
So this is going to be a Vlookup formula finally.
Unfortunately, I didn't make it to the Vlookup part yet because the ArrayFormula part is not working.
I started off by looking to the cell value at the left with this formula, which worked, but the ArrayFormula part of it DOESN'T work.
=ArrayFormula(indirect(ADDRESS(ROW(), COLUMN()-1)))
I know that some functions don't work very well with ArrayFormula,
But I don't see any reason here this should not work because it's only looking to its row and its column.
I hope the image shows the problem well enough
If you just want to repeat the values from the previous column (let's say column A, starting in row 2), you can try in column B (also in row 2)
=Arrayformula(if(len(A2:A), A2:A,))
Change range to suit. See if that helps?
UPDATE: To repeat the previous column (anywhere you input the formula) try (in row 2)
=offset(A1, 1, column()-2, rows(A1:A))
To 'limit' the output you can use any number instead of rows(A1:A) or replace it with COUNTA(A1:A)...
you can do something like this, which will search for specific header across entire sheet and then return values of that column:
=QUERY({INDIRECT("Sheet1!"&
ADDRESS(1, MATCH("job ID", Sheet1!1:1, 0), 4)&":"&
ADDRESS(1000000, MATCH("job ID", Sheet1!1:1, 0), 4))},
"select * where not Col1 matches 'job ID' and Col1 is not NULL", 0)
without sheet name:
=QUERY({INDIRECT(
ADDRESS(1, MATCH("job ID", 1:1, 0), 4)&":"&
ADDRESS(1000000, MATCH("job ID", 1:1, 0), 4))},
"select * where not Col1 matches 'job ID' and Col1 is not NULL", 0)