SUMIF/SUMPRODUCT match multiple criteria within date range - excel-2010

I have a table (Sales) data that has two sets of columns with code, amounts and date reference:
And I have another table (Sheet1):
which need to sum the total net amount with one set subtract the other set on the Sales table but it have to matched the code and based on the weekly date range in Sheet1 table. I can sum the total amount together but I can't separate it with date.

Try:
=SUMIFS(Sales!I:I,Sales!F:F,$A4,Sales!G:G,$C4,Sales!H:H,">="&Sheet1!D$1,Sales!H:H,"<="&Sheet1!D$2)
IF you want the difference between the sum of the blues and the sum of the reds subject to the same conditions, repeat the above (with adjustments to suit) at the beginning and link the two together with a -.

I've work this one out. This is my formula:
=SUMPRODUCT(--(Sales!$C$1:$C$1000>=$C$1),--(Sales!$C$1:$C$1000<=$C$2),--(Sales!$A$1:$A$1000=A4),Sales!$D$1:$D$1000)-SUMPRODUCT(--(Sales!$H$1:$H$1000>=$C$1),--(Sales!$H$1:$H$1000<=$C$2),--(Sales!$A$1:$A$1000=A4),Sales!$I$1:$I$1000)

Related

Creating Google Sheets pivot tables with custom formula

I am creating table for finance: will have a data base of trades: date open and close for trade (), open and close prices, ticket is a stock name, change is percentage which is calculated base on open-close price and days are also calculated base on two dates as on the picture:
And I need to generate a new table for each month of the year (in which I have date records). So, Google sheets has Pivot tables and that what I need. I need columns: average win % per month, average loss % per month, average number of win days per month, average number of loss days per month.
I did that in 2 separate tables:
First table:
First table settings:
Second table:
Second table settings:
But I can not create that in one table - I do not know how to make custom formula. So, I am looking for some help here.
I tried some things, I can filter, make average. But I do not know how to get array of items with sorted pivot table data by months...If I can get sorted pivot table data by months - I can filter by positive/negative and find average.
My sample: https://docs.google.com/spreadsheets/d/1TCLWZ7-oUSwM8DLODPpH6wwssgfYyo3BVlEpWj78kV4/edit?usp=sharing

Count string occurrence IF 2 conditions are met

I have this data set (example)
It shows different responses for different towns and what industries the respondent thinks has job openings (e.g Akron has 2 rows (2 respondents), with different industries given)
Now I want to chart/gather from that data set, the count of each industry for each town: So using this table setup, I want a formula that shows, for example, how many times "restaurant" was listed for Akron...
So here's what I want a formula to give me, in cell B63, ("Akron" row, "restaurant" column) for ex. This is paraphrasing in plain English what I want it to do. I have tried countless variations of COUNTIFS, IFS, MATCH, SUM, INDIRECT, LOOKUPS... etc and have not been able to get the numbers that reflect the data given.
=count if ("restaurant" appears in the range B53:D60 AND if those occurrences are in rows starting with "Akron" (in the range A53:A60))
The main hang-up, obviously is that these 2 different criteria encompass 2 different sized ranges (not something countifs like...) So how can I get around that barrier?
A final note: the imgs/ex given are small representations of a much larger range that I'm actually working on... so yes, I could make a nifty formula for each town that has just the town rows as my range...(COUNTIF likes this approach!) but I've got many more towns of various row counts... it takes too long to make a town specific range or diff formula for each town... I prefer 1 formula that looks through all the town rows/range and all the "Industries" range...
=COUNTIF(FILTER(DATA_RANGE,TOWN_NAME="TARGET_TOWN_NAME"),"=TARGET_INDUSTRY")
Example use
=COUNTIF(FILTER(A2:C,A2:A="A"),"=1")
Counts the responses of 1 under town A.
Example Screengrab

Sum every nth cell in a row infinitely

I am making a spreadsheet for my football (or soccer) team, and tracking how much each player has paid and whether they're in credit/debt so I'm calculating the balance in Sheet1 per game and then in Sheet2 calculating the total balance.
The formula I am trying to do is, in Sheet2 trying to SUM each value under the "Balance" column for (every 3 cells) for Aidan together to get the total balance.
At the moment I am just doing the following but need it to accommodate an infinite amount of columns (fixtures) and be scalable because currently, this is not.
=SUM(Sheet1!D3, Sheet1!G3)
Any help would be massively appreciated.
you can use FILTER of MOD in SUM like:
=SUM(FILTER(B2:2, MOD(COLUMN(B2:2)+2, 3)=0))
Since the goal is to sum all values from columns with header "Balance", you could also do this:
=sumproduct(Sheet1!$B$2:$J$2="Balance",Sheet1!B3:J3)
That way you don't have to worry about the index of those columns, should you ever decide to add more columns to your sheet.

Automatically increment a COUNTIF date criterion

https://docs.google.com/spreadsheets/d/1EUgEwLmiNv9ug66DWzXjnuZ2GzavSbNqs-UTysiwZbM/edit?usp=sharing
I have this Google Sheets with multiple tabs that record projects published on a date.
One of the tabs (Stats) records the total number of projects published by everyone on a particular day. I am using COUNTIF in the last tab to record productivity. I don't want the range to change when I drag the formula: I want the criterion to add a date automatically so as to get the result for the next day. I am having to re-write the formula.
Bob on the left, Randy on the right:
Output (Stats):
In Stats!C2 and copied across and down to suit:
=countifs(indirect(C$1&"!A:A"),"="&$A2,indirect(C$1&"!C:C"),"Done")
should be sufficient, provided you make the column labels in Stats match the sheet names (even for spaces).

Calculating rows that match a month in the header

I'm trying to calculate the monthly totals for fruit that I record sales of weekly.
I have a table that records the above data.
I would like another table that calculates the SUM values for each month for that fruit. Because every month has a potentially different number of weeks, I need a formula to essentially cycle through the weeks for the particular fruit I'm interested in and SUM the values for that month dynamically.
I've tried a bunch of different things, like:
=IF(A3:A5="Banana", SUM(INDEX(C2:J2,,MATCH("January",C3:F3))))
...in the hopes that I could somehow:
Search for a fruit in a table
If found, run through the weeks and
calculate monthly values
Spreadsheet here
In B9 try this formula
=sum(filter(filter($C$3:$5, month($C$2:$2)=column()-1), $A$3:$A$5=$A9))
Fill down and to the right as far as needed.

Resources