For reference, please visit this Google Doc which is a simplified example of my problem, which is to determine total sales in Blue and Green markets each month.
Each month, I receive a new sales report from accounting for all of our markets and I add the sheet to the main workbook. My team is in charge of assigning "colors" to the markets and tracking this. As it's privileged information, we can't have accounting auto-tag these in the data they send over.
One solution would be, for each new monthly report that comes in, tag each city with the color. However, we have hundreds of markets and this isn't very practical to go through each time.
I assume that a SUMIFS function would work here, but am unsure how to set it up when there are values spread across multiple sheets.
You can use this function in B8 of February tab:
=SUM(IF(COUNTIFS($A$2:$A$5,Color!$A$2:$A$5,Color!$B$2:$B$5,'Sales February'!A8)>0,$B$2:$B$5,0))
COUNTIFS($A$2:$A$5,Color!$A$2:$A$5,Color!$B$2:$B$5,'Sales February'!A8)>0 gets an array of the countries that belong to the colour specified in A8 of the current tab (Would that be possible to put only Green and remove February Sales from that cell?).
If the country belongs to the particular colour, then return the array of corresponding values in column $B$2:$B$5.
Lastly, sum this array.
Note:
You need to array enter this formula in Excel (by holding Ctrl+Shift then hit Enter after typing in the formula).
In Google Spreadsheets, you array enter a formula by wrapping the formula around =ArrayFormula(), meaning you use:
=ArrayFormula(SUM(IF(COUNTIFS($A$2:$A$5,Color!$A$2:$A$5,Color!$B$2:$B$5,'Sales February'!A8)>0,$B$2:$B$5,0)))
In Excel you can use this "array formula"
=SUM(SUMIF(A$2:A$5,IF(Color!B$2:B$5=A8,Color!A$2:A$5),B$2:B$5))
confirmed with CTRL+SHIFT+ENTER
The same formula works in google docs if wrapped in arrayformula, i.e.
=arrayformula(SUM(SUMIF(A$2:A$5,IF(Color!B$2:B$5=A8,Color!A$2:A$5),B$2:B$5)))
or you can use FILTER as user3465711 suggests, i.e.
=SUM(filter(B$2:B$5,isnumber(match(A$2:A$5,IF(Color!B$2:B$5=A8,Color!A$2:A$5),0))))
Related
Building a dynamic schedule dashboard in Google Sheets.
Limited to using only functions and formulas, no scripts.
Have a living table (range A1:M) where each row represents a different event.
I need to pull multiple rows of data (all text strings) and populate into single column.
Some columns may be empty (ie. not all events have an Agenda or a Group associated with them).
Query and some other functions don't work because they won't pull the hyperlinks.
The below function works, but I cannot figure out how to get it to skip the blank cells.
=FLATTEN(FILTER($F$2:$M, $B$2:$B=$O$2, $D$2:$D=$Q$2, $E$2:$E=$P$2))
It would be great to add a blank column at the end though that is NOT skipped, so when it returns each row of event details into a column, there is a space between each event.
Here is an example of the table:
Calendar
Event Type
Cadence
Day
Title
Descrip.
Agenda
Group
POC
Team A
Optional
Weekly
Monday
Co. Q&A
Info.
hyperlink
website
John
Team B
Mandatory
Bi-Weekly
Tuesday
Team mtg.
Info.
blank
website
Amy
Team C
Mandatory
Weekly
Monday
Mgr. Sync
Info.
hyperlink
blank
Chris
Tried IF statements with ISBLANK as well as <>"" but I am not sure if I am putting those in the right place.
The formula below is another variation, which works to populate a separate sheet, but it also does NOT skip blanks and is only pulling the first instance found.
=iferror(VLOOKUP(CONCATENATE($D$3,$C$8,D$7), DataC!$A$1:$M$160,MATCH($A$11,DataC!$A$1:$M$1,0),0),"")
you could try wrapping your working formula within QUERY()
=QUERY(FLATTEN(FILTER($F$2:$M, $B$2:$B=$O$2, $D$2:$D=$Q$2, $E$2:$E=$P$2)),"Select * Where Col1!=''")
My team has a vacation tracking calendar in Google Sheets. I'm trying to create a formula (for the red cells) to automatically count the number of days entered in the calendar by person and absence code.
I've tried a number of different ways to solve this using Countifs, Match and Index but it only works for a single range, yet I need to count one range for each month of the year.
Is there an easier way to do this than adding 12 similar formulas together.
Assuming you don't need a spill range you could just do a basic countif off of a filtered range on the name.
so if your data starts on A8 and goes all the way to column f (you'd want more), and you put the exact string you're searching above the cell in row 3, this should work:
=countif(filter($A$8:$F,$A$8:$A=$C3),D$2)
Here's a sample sheet from screen shot.
I am trying to find a formula that will give me the count of unique dates a persons' name appears in one of two different columns and/or both columns.
I have a set of data where a person's name may show up in a "driver" column or a "helper" column, multiple times over the course of one day. Throughout the day some drivers might also be helpers and some days a driver may come in for duty but only as a helper. Basically all drivers can be helpers, but not all helpers can be drivers.
I've attached a link to a sample sheet for more clarity.
https://docs.google.com/spreadsheets/d/1GqNa1hrViX4B6mkL3wWcqEsy87gmdw77DhkhIaswLyI/edit?usp=sharing
I've created a REPORTS tab with a SORT(UNIQUE(FLATTEN)) Formula to give me a list of the names that appear in the DATA Tab.
I'm looking for a way to count the unique dates a name from the name (Column A of the REPORTS Tab) appears in either of the two columns (Column B and/or C of the DATA Tab) to determine the total number of days worked so I can calculate the total number of days off over the range queried.
I've tried several iterations of countif, countunique, and countuniqueifs but cannot seem to find a way to return the correct values.
Any advice on how to make this work would be appreciated.
I think if you put this formula in cell b7 you'll be set. You can drag it down.
=Counta(Unique(filter(DATA!A:A,(DATA!C:C=A7)+(DATA!B:B=A7))))
Here's a working version of your file.
For anyone interested, Google Sheets' Filter function differs slightly from Excel's Filter function because Sheets attempts to make it easier for users to apply multiple conditions by simply separating each parameter with a comma. Example: =filter(A:A,A:A<>"",B:B<>"bad result") will provide different results between the Sheets and Excel.
Excel Filter requires users to specify multiple conditions within parenthesis and denote each criterion be flagged with an OR condition with a + else an AND condition with a multiplication sign *. While this can appear daunting and bizarre to multiply arrays that have text in it, it allows for more flexibility.
To Google's credit, if one follows the required Excel Syntax (as I did in this answer) then the functions will behave the same.
delete what you got and use:
=QUERY(QUERY(UNIQUE({DATA!A:B; DATA!A:A, DATA!C:C}),
"select Col2,count(Col1),"&D2&"-count(Col2)
where Col2 is not null
group by Col2"),
"offset 1", 0)
I'm working on an inventory system in Google Sheets and I need to pull data from one sheet into another sheet within the same work book.
I have two lists of parts, one is an indented BOM, that shows quantity of parts. The other is a Purchasing/Receiving log for inventory.
I need to compare the BOM with the Purchasing sheet to find the first instance of an order for that part, then check if it is still open or not, then pull the expected delivery date into the matching row in the BOM sheet assuming that order is still open.
These are the two formula I have that are the closest.
=IF(ISBLANK(A2),"",(SUMIF('PURCHASING/RECEIVING LOG'!D:D,B:B,'PURCHASING/RECEIVING LOG'!L:L)))
This one SUMS the date value, resulting in way off dates when converted back into a date format, but it correctly lines up all dates from PURCHASING RECEIVING, that match part name in BOM
=IF(B:B='PURCHASING/RECEIVING LOG'!D:D,IF('PURCHASING/RECEIVING LOG'!C:C="OPEN",'PURCHASING/RECEIVING LOG'!L:L,"WRONG"),"WRONG2")
This one correctly checks if the purchase order is open or not, but it only pulls the date if the rows match, instead of matching up the data for both columns. So if 'BOM'!B2 = 'PURCHASING RECEIVING'!D2. I need to check if any row in 'PURCHASING RECEIVING'!D:D = 'BOM'!B2, then B3 then B4 etc. Then pull the relevant information from 'PURCHASING RECEIVING'!L:L
Neither of them pull only the first instance of a matching open order.
There are duplicate parts in both the BOM and the Purchasing sheet, since multiple machines use the same parts, and we have multiple open orders for the same parts at any given time.
Any help or if someone could point me in the right direction would be greatly appreciated.
Please let me know if there are any questions.
Thank you.
EDIT: Added sample sheet
https://docs.google.com/spreadsheets/d/1fsrl4h__GbtHeHUCBs0PS25HR8MhWEplQ2bY-qcdWlw/edit?usp=sharing
You can use a QUERY on the second sheet to pull the required date, for example in cell G3, you would use:
=QUERY('PURCHASING RECEIVING'!$B$2:$E,"select min(E) where B = 'OPEN' and C ='"&E3&"' label min(E) ''")
And then drag down to the rest of the rows.
Sample Output:
Reference:
QUERY function
Query Language Reference
I am creating a home budget for myself in Google Sheets, working in Chrome on Windows 10. In the end, the budget will be composed of separate sheets for each month, containing tables for each Friday (payday) within that month. All such tables will follow a certain format and will pull arrays of budget data from an auxiliary sheet.
However, trial-and-error (mostly error) is abundant, and one quails at the thought of having to paste corrections across 52 tables. Is there any way to have each table emulate a formula set down in a template? For example, ideally, my template would contain something like:
=INDEX(IF(condition(relativeCell),namedRange1,namedRange2)
and the final product would pull that formula (with relative reference) to each table. If I discover a mistake or need to make a change, I can simply change the template, and all of the live tables would update their formulas.
Can this be done in Google Sheets?
Failing that, I already have a function that returns a cell's formula as string text. Can this be used to get the desired effect?
there is a formula called INDIRECT which does exactly that:
https://support.google.com/docs/answer/3093377?hl=en