SUMPRODUCT with 3 criterias including date - excel

I've been trying to come up with a formula to sum a specific amount.
It has 3 criterias: 1st is an account number: column A; 2nd is a Cost Center number: column C; and 3rd is a date from line i1 to T1 (eg.:i1= jan/2020; t1=dez/2020).
The dates are formated with "date" type: mar/12 on both sheets.
The date on the formula refers to a specific cell $F$2 in order for me to just comeback there, type the month that i want and it automatically calculates the values while taking into account the other criterias.
This is the formula i adapted from some research.
=SUMPRODUCT(Sheet2!$A:$A=Sheet1!$C20)*(Sheet2!$C:$C=Sheet1!$H3)*(Sheet2!$I$1:$T$1=Sheet1!$F2)*(Sheet2!$I$2:$T$635)
This formula currently gives back 0 instead of the value pretended (which is ~631)
Here are 2 prntscreens as form of sample, i hope it helps.
Sheet1 with formula
Sheet2
Thank you.

Related

Find row when Cumulative sum reaches certain value with condition #2

This question is based on the answer provided in the thread linked below. I have the same question byt my data is ordered a bit different.
Find row when Cumulative sum reaches certain value with condition
In sheet1 I have columns ID, COST and Profitability Date. (ABC)
In sheet2 I have a date row (ex 201801) running horizontally starting in B1 (B1,C1 etc..). Starting in A2 i have the different ID's running vertically. The Revenue for each ID follows beneath the date row.
I would like to have the formula in Profitability Date (sheet1 column C) to return the date (sheet2 row 1) when the cost (sheet1 column B) is >= than the revenue in sheet2.
Enter the following array formula in C2, confirm with CONTROL+SHIFT+ENTER, and copy down:
=INDEX(Sheet2!$B$1:$J$1,MATCH(TRUE,SUBTOTAL(9,OFFSET(INDEX(Sheet2!$B$2:$J$4,MATCH(A2,Sheet2!$A$2:$A$4,0),0),,,,COLUMN(Sheet2!$B$1:$J$1)-COLUMN(Sheet2!$B$1)+1))>=B2,0))

Showing datatable as a visual

I have some data which includes a list of tasks for 2 individuals.
I want to represent this data in the following format.
So that it looks like the below.
How can I achieve this with the use of formulas?
[EDIT]
I don't think this question is the same as 'Data Wrangling in Excel - Rearranging Columns and Rows' as mine is about reflecting schedules in a more gantt chart-esque like format, whereas the other question seems to be more about transposing data.
Not sure if you have your desired output on the same sheet or a new sheet, but I used a new sheet starting in cell A1. The source datasheet is referred to as S1 in the formulas.
Assumptions:
Column C = Date Start
Column D = Date End
Persons' entries are grouped together (Person1, Person1, then Person2; never Person1, Person2, Person1)
Person can't be assigned two different areas for the same timeframe (e.g., Person1 can't have A and B for a given month)
Your desired dates are always the first of the month
Output/Formulas:
A1 is blank
A2: =INDEX('S1'!$A$1:$A$6,IFERROR(MATCH(A1,'S1'!$A$1:$A$6,0),1)+COUNTIF('S1'!$A$1:$A$6,A1))
A3: Formula copied down from A2
B1: =IF(A1<>"",EDATE(A1,1),MIN('S1'!$C$1:$D$6))
C1 to J1: Formula copied from B1
B2: =INDEX('S1'!$B$1:$B$6,MATCH(1,INDEX(('S1'!$A$1:$A$6=$A2)*('S1'!$C$1:$C$6<=B$1)*('S1'!$D$1:$D$6>=B$1),0),0))
B3 and C2 to J3: Formula copied from B2
Explanations:
The A2 formula: Looks at where the previous Person entry first occurs (MATCH part), and counts how many entries it has (COUNTIF part) to determine the next Person entry in line (INDEX part). The IFERROR portion is used to return the first Person entry, which is assumed to be on row 1.
The B1 formula: Adds one month to the previous date heading (EDATE part). The very first date heading looks for the earliest date in your source data (MIN part).
The B2 formula: Uses a match with multiple criteria on your source data (Person entry must match the indicated person, start date must be before or on the date heading, and end date must be after or on the date heading). The second INDEX creates an array of the combined criteria results (1 if true, 0 if false), and the MATCH returns which entry that is. The first INDEX returns the task (A, B, or C).

How do I write an excel formula to count the number of a value in one column based off of a date in another column?

I have a worksheet and I'm trying to do a simple Count function, probably a countif but I'm unsure how to go about writing the formula.
I have two columns that I'd like to use for this formula.
Column N - I would like to filter for the Criteria of "C" or anytime a cell has a value of C
Column 0 - This column has dates filled in (short date format).
I would like to get a count of every C for each month, as simple as that.
In this example I filtered the date for May of 2017 and filtered for C under the Check column. We can see that there are 12 instances of C showing in the month of May 2017.
Does anyone know how to structure a formula that I would be able to Count the Number of C's for every month into the foreseeable future?
I figured out how to count the total present in a date range but unsure of how to add the date range plus Column N (Check) every time "C" is present in the cell.
=SUMPRODUCT((O:O>=DATEVALUE("5/1/2017"))*(O:O<=DATEVALUE("5/31/2017")))
Try this
=COUNTIFS(O1:O100,">="&A1,O1:O100,"<"&B1,N1:N100,"C")
Where A1 has the start date and B1 has the end date for that month. You can use DATEVALUE() instead of A1 and B1. Change as applicable
Screenshot
If you want to use SUMPRODUCT then see this
=SUMPRODUCT((O:O>=DATEVALUE("1/5/2017"))*(O:O<=DATEVALUE("30/5/2017"))*(N:N="C"))
In another column (lets say 'P' for example) I would insert a formula to give you the month number =Month(P7) - this will return 5 for May.
I would then use COUNTIFS (Like COUNTIF but it uses multiple criteria) to count where column N contains 'C' and column 'P' contains '5'.
=COUNTIFS(N:N,"C",P:P,5)
Try this....you need to select the entire Column B and named the column as 'Date'.enter image description here

Calculate SUM based on date

This is driving me nuts and I don't know what I'm doing wrong.
I have an excel table where my turnover is in with the date of incoming invoices. The date is in format ddmmjjj and is in column C.
I want to calculate my turnover on my dashboard. The total turnover is in column G.
The formula I use is:
=SUM(IF(MONTH(Sheet1!C:C)=2;Sheet!G:G;))
But this formula keeps giving me the total turnover... What am I doing wrong?
You need to use the SUMIF function in Excel, which allows you to sum up certain cells if the values in associated cells match a criteria:
SUMIF(range, criteria, [sum_range])
In your case, you'd want to extract the month for the dates in column C into another column (say column X holds the month for the dates in column C), and then:
=SUMIF(Sheet1!X:X, 2, Sheet1!G:G)
The formula you are using is correct, however you need to enter it as an array formula (via Ctrl + Shift + Enter).
=SUM(IF(MONTH(Sheet1!C:C)=2,Sheet1!G:G,0))

Multiple criteria to sum a range of data

I'm using Excel 2013:
I calculated when income/expense would fall on a given date in the year: Budget sheet on top, Event Calc sheet on bottom
On my "Budget Adjust" sheet, I then wanted to sum the amounts with the criteria of: 1) within two dates and 2) matching the income/expense type:
While I now understand that I can't use SUMIFS (because my data to sum and date criteria are different sizes), I'm wondering if any of you have a brilliant idea about how to sum the data for specific date ranges and a type match.
ADDITIONAL INFO: Using the data in the first few columns, I created a dynamic formula for each day in the year, so columns T:NV, with a day of the year in Row 1:
=IF($D2<>0,IF(AND(U$1>=$C2,(U$1-$C2)/$D2=ROUND(((U$1-$C2)/$D2),0)),$B2,0),IF(DAY(U$1)=$E2,$B2,0)).
For that day of the year, for the type of income/expense, it would enter either the income/expense that would fall on that day, or zero. There are 365 such columns (T:NV), one for each year.
My attempt was to use the range of data (T2:NV20) in one formula on the Budget Adjust sheet that would search for: 1) within a given date rage, and 2) for each Type, then return the Sum of the amounts found within that date range
--- EDIT ---
I want an elegant answer, with one formula in the results field, but here's how I've made it work:
I'm limited to two pics per post, so here is a pic of both sheets:
My work-around to get the answer
On top is is the Event Calc page, where I've created a column for each month, and H2 is highlighted with the formula above:
=SUMIFS($U2:$NV2,$U$1:$NV$1,">="&H$1,$U$1:$NV$1,"<"&I$1)
On the bottom is the Budget sheet with D9 (Salary for Jan-2016) highlighted:
using this formula:
=SUMIFS('Event Calc'!H$2:H$20,'Event Calc'!$A$2:$A$20,"="&$B9)
Why wouldn't you just use 'Event Calc' columns A, B and C? That is already in a proper format for a SUMIFS formula. On sheet "Budget Adjust" cell D17, use this formula:
=SUMIFS('Event Calc'!$B:$B,'Event Calc'!$A:$A,$B17,'Event Calc'!$C:$C,">="&D$10,'Event Calc'!$C:$C,"<="&D$11)
and then copy right and down

Resources