I have a spreadsheet that has summary information for individuals by month, and I want to sum the information for all participants, but I need to break it down conditionally by year. The big issue is that the information is not all stacked on top of each other in two columns(month & info), they are broken up by person with titles in between, so I have to use multiple ranges.
For example, my code now looks something like this:
=sumif([A2:A6,A9:A17,A19:A25], "<13", [D2:D6,D9:D17,D19:D25])
Except I am doing this with hundreds of ranges. The brackets are not working and I am not sure how to use an Array. I would really appreciate someones help on this, as I have been racking my brain for awhile now.
Maybe:
=sumif(A:A,"<13",D:D)
or, if there are values in row26 or below and in row1 to be excluded:
=sumif(A2:A25,"<13",D2:D25)
If I got you right, the following would work:
=sum(filter(D2:D25,ISNUMBER(A2:A25),A2:A25 >13))
The idea:
Filter for rows that are numeric (you said the content in between are titles!?) and meet your requirement (>13).
Sum it up! (By the right column)
Related
I have a table of data that I want to turn from raw data into something a little 'prettier' and organized to look at.
The data consists of payments made (3 columns: Name, payment amount, and date of payment).
I'd like to present the data so that for each group of dates that are the same there is a header above those rows with the date itself so the user can see these rows of dates are for say 1/14/2023.
Then the next set of rows for say 1/15/2023 would have the header 1/15/2023.
Please see the attached image.screenshot
In columns A - C is the raw data and I don't know how many and which dates there will be a priori. In columns E-G is the desired output.
You can see I'd also like if possible a footer that sums the totals for that day.
Any ideas on how to achieve this? The ideal solution would be such that you could paste raw data into columns A-C and then the data shows up in columns E-G formatted. I'm hoping there's a design pattern for this type of thing before I cobble together a solution.
I've implemented something through Apps Script, but am more interested in learning if there's a way through the formulas provided in Sheets.
I can see this possibly being done with temp/work tables, but am wondering if this is a common problem/solution and would love to get pointed in the right direction. I'm a programmer and have been using sheets for about a year and can write queries and filters and do lots of things but want to learn the right way and not always just do something the first way that pops into my head that works.
try this formula along with a bit of conditional formatting to get the expected output.
Headsup: Set Columns E, F to DATE Type formatting
=LAMBDA(czx,MAP(INDEX(czx,,1),INDEX(czx,,2),INDEX(czx,,3),LAMBDA(ax,bx,cx,{ax,IF(ISNUMBER(ax),{"",""},IF(ax="TOTALS",{"",cx},IF(LEN(ax),{bx,cx})))})))(SORT(LAMBDA(ax,FILTER(ax,INDEX(ax,,1)<>""))({BYROW(UNIQUE(B:B),LAMBDA(bx,IF(bx="",,{bx,bx,0})));A:C;BYROW(UNIQUE(B:B),LAMBDA(bx,IF(bx="",,{"TOTALS",bx,SUMIF(B:B,bx,C:C)})))}),2,1))
In some column have formula like below:
=SUM(MMULT(IFNA(FILTER($H$2:$H;$G$2:$G=M2);0);L2))
I have expanded it in 3 rows (A1:A3):
=SUM(MMULT(IFNA(FILTER($H$2:$H;$G$2:$G=M2);0);L2))
=SUM(MMULT(IFNA(FILTER($H$2:$H;$G$2:$G=M3);0);L3))
=SUM(MMULT(IFNA(FILTER($H$2:$H;$G$2:$G=M4);0);L4))
And I'm getting right results.
Then I want to get sum of those. But I need to create all of above in one line.
I mean - I don't want to calculate above separately and then do something like SUM(A1:A3).
I was trying with ARRAYFORMULA() but with no success, yeah, how hard can it be, right?
Have a nice evening!
UPDATE:
If someone will look for the solution, the best one is Mike's solution. Take a look at picture what he has added.
I have just extended it to filter L and M columns and it does not matter how long columns are. Of course L and M columns have to have the same number of elements ;)
=SUM(MMULT(ARRAYFORMULA(--(G2:G=TRANSPOSE(FILTER(M2:M;ISTEXT(M2:M))))*(H2:H));FILTER(L2:L;ISNUMBER(L2:L))))
You should be able to nest the evaluations inside a SUM, like the below and get a SUM of the SUM's so to speak.
=SUM(SUM(MMULT(IFNA(FILTER($H$2:$H;$G$2:$G=M2);0);L2)),SUM(MMULT(IFNA(FILTER($H$2:$H;$G$2:$G=M3);0);L3)),SUM(MMULT(IFNA(FILTER($H$2:$H;$G$2:$G=M4);0);L4)))
There probably is a more efficient way, but why over complicate it. :)
Try this
=sum(mmult(arrayformula(--(G2:G=transpose(M2:M4))*(H2:H)),L2:L4))
the formula =arrayformula(--(G2:G=transpose(M2:M4))*(H2:H)) will give you a matrix as follows, then apply mmult
I think my brain is going to explode. I must be thinking about this to much.
I'm trying to make a spreadsheet to keep track of apartments and cars for a construction project. We only have so many cars and so many apartments. Im trying to schedule subcontractors so they don't overlap with each others apartments and cars.
Here is the code I have so far...
=IF(ARRAYFORMULA(B:B)=Data!$A$1,IF(DATEVALUE(D17)>=DATEVALUE(D18),IF(DATEVALUE(E18)>=DATEVALUE(E17),"Ok","Overlap")"Ok","Overlap"),"")
Please see my spreadsheet here for a better example of what I am looking for.
https://docs.google.com/spreadsheets/d/17t_8nhKfu3vy3OpAWZ_6Ep5Xn-4kwo8Xo4E6WuYVbFY/edit?usp=sharing
Thank you so much in advance!!!
You can try the formula below and paste it on the H3 cell for example. Afterwards, you will have to drag it down the column such that all the entries are covered.
As for the formula, it makes use of IF and COUNTIFS in order to check the conditions:
=IF(COUNTIFS(B$3:B3,B3,D$3:D3,"<="&D3,E$3:E3,">="&D3)>1,"Date Overlap",IF(COUNTIFS(C$3:C3,C3,D$3:D3,"<="&D3,E$3:E3,">="&D3)>1,"Vehicle Overlap","Ok"))
Reference
COUNTIFS function;
IF function.
I'm trying to create a dynamic dashboard for staff to track the total amount of time they've worked for our program. They fill out a form with start/end time and denote if it's work that's eligible for our program to pay them for it. I'm building a dashboard where they can see how many extended hours they've racked up over the course of the school year because we have limits on how many hours they can earn.
I'm including an editable
copy of my spreadsheet to show what I've got so far... I'd like to add up any durations in column E that have a "Yes" in Column F (which is all of them at the moment) and have that sum sit in cell C5. But all I can get it to do is sum up to zero, and I can visibly see that it should be more than zero. I've tried changing the format of the cell(s) too, but it's still zero.
Any help or ideas are greatly appreciated! And I'm always trying to learn and improve, so if you know how to do this and don't mind explaining to me how the solution works, I'd also really appreciate that so that I can keep getting better at Sheets. :)
Thanks in advance!
This is because the numbers in column J (in Data sheet) are stored as text. Either enter them instantly as numbers or use the helper column where they are converted by the formula e.g. =VALUE(J1)
Played around with it enough that I got it finally!
=SUM(ARRAYFORMULA(if(C8:C="Yes",E8:E-D8:D,0)))
Thanks for helping me troubleshoot and think it through!
I am using Google SpreadSheet, and I'm trying to have multiple sheets containg a list of words. On the final sheet, I would like to create a summative list, which is a combination of all the values in the column. I got it sort working using =CONCATENATE() , but it turned it into a string. Any way to keep it as a column list?
Here is an example as columns:
Sheet1
apple
orange
banana
Sheet2
pineapple
strawberry
peach
FinalSheet
apple
orange
banana
pineapple
strawberry
peach
Updated Answer
I was right there is a much better solution. It's been posted below but I'm copying it here so it's in the top answer:
=unique({A:A;B:B})
Caveat: This will include one blank cell in certain scenarios (such as if there's one at the end of the first list).
If you're not concerned with ordering and a tailing blank cell a simple sort() will clean things up:
=sort(unique({A:A;B:B}))
Otherwise a filter() can remove the blanks like so:
=filter(unique({A:A;B:B}),NOT(ISBLANK(unique({A:A;B:B}))))
The following is the old deprecated answer
I'm confident that this is "The Wrong Way To Do It", as this seems such an absurdly simple and common task that I feel I must be missing something as it should not require such an overwrought solution.
But this works:
=UNIQUE(TRANSPOSE(SPLIT(JOIN(";",A:A,B:B),";")))
If your data contains any ';' characters you'll naturally need to change the delimiter.
The basic way, is just to do it as arrays like so
={A1:A10;B1:B10...etc}
The problem with this method, as I found out is that its very time consuming if you have lots of columns.
I've done some searching around and have come across this article:
Joining Multiple Columns Into One Sorted Column in Google Spreadsheets
The core formula is
=transpose(split(arrayformula(concatenate(if(len(A:Z)>0,A:Z&";",""))),";"))
Obviously you'd replace the A:Z to whatever range you want to use.
And if you want to do some sorting or removing duplicates, you'd simply wrap the the above formula in a SORT() and/or UNIQUE() method, like so..
=sort(unique(transpose(split(arrayformula(concatenate(if(len(A:Z)>0,A:Z&";",""))),";"))))
Hope this helps.
Happy coding everyone :)
You can use this:
=unique({A1:A;B1:B})
Works perfect here!
The unique() function gets rid of blank spaces, but wasn't helpful for me because some of my rows repeat. Instead I first filter the columns by len() to remove blank cells. Then I combine the columns together in the same way.
={filter(A:A, len(A:A)); filter(B:B, len(B:B))}
Much more simple:
={sheetone!A2:A;sheettwo!A2:A}
Use flatten, e.g. flatten(A1:B2). More details in this article.
If the 2d range is not in one piece, one can be created first with the ampersand or similar techniques. Afterwards flatten can be called on the resulting 2d range. The below example is a bit overkill but it is nice when working with dynamic 2d ranges, where the basic solution can't be easily used.
flatten(ARRAYFORMULA(SPLIT(ARRAYFORMULA(A1:A2&";"&C3:C4), ";")))
The article shows also how to easily unflatten a range using the, as well undocumented, skipping clause in a query.
=TRANSPOSE(SPLIT(TEXTJOIN("#",TRUE,TRANSPOSE(A:C),TRANSPOSE(D1:D5)),"#",FALSE,FALSE))
use a preferred delimiter absent in the data (instead of #) if needed
the first 1 (TRUE) parameter means IGNORE EMPTY, which is very important in this case..
the A:C and D1:D5 are the ranges to combine
all values remain there - not using UNIQUE
Try using your CONCATENATE argument with
=ArrayFormula(EXPAND(...))