Add values for each cell values those are followed up and add 0 for missing date values in excel - excel

I have two columns
Quantity Date
2 02/01/2014
3 04/01/2014
4 07/01/2014
5 07/01/2014
1 08/01/2014
3 08/01/2014
I want to add the quantity values for each date and put 0 for dates those are missing. So end result would look like below
Quantity Date
0 01/01/2014
2 02/01/2014
0 03/01/2014
3 04/01/2014
0 05/01/2014
0 06/01/2014
9 07/01/2014
4 08/01/2014
0 09/01/2014
. ...
. ...
. ...
Can't think of a way, can someone help please

I don't have Excel in front of me, but I'll take a stab at it.
Leave your first dataset in Sheet1, but reverse the columns.
Then type
Date
01/01/2014
02/01/2014
03/01/2014
....
...into Column A of Sheet2 and drag the cells down to expand the series as far as it needs to go.
Then do a =vlookup(A1, Sheet1!A$1$:B$99999$, 2, FALSE) in column B of sheet two.
You'll get errors, where you don't have dates in Sheet1, so you can fill those in by modifying the above equation to: =IFERROR(vlookup(A1, Sheet1!A$1$:B$99999$, 2, FALSE), 0)
(I think).

Related

excel formula to filter range based on criteria

I have a strange problem I've been trying to find a good solution to for the past few hours. I have a table in excel similar to the following:
|A B C D E F
-----+-----+-----+-----+-----+-----+-----
1 |2011 1 0 -5 4 2
2 |2011 2 1 1.2 2 3
3 |2011 3 1 2 4 -4
4 |2011 0 1 -3 3 -2
5 |2012 5 1 0 0 1
6 |2012 0 1 0.25 0 0
the data falls into different categories based on columns A-C, with columns D-F being dollar amounts.
What I'm trying to figure out is, is there a way to return the max absolute value of columns D-F for a subset of these rows using the values in columns A-C as filter values? Now, I know how to return the max absolute value of a range: =max(abs(START:END)), but what I don't know how to do is filter out some of the rows from the range based on their column A-C values.
Perhaps a specific example of what I'm looking for:
How would I get the range D-F where:
A=2011
B<>0
C=1
For the above set of conditions and data, the answer I'd like to have returned is 4, from E3.
I am not opposed to adding helper columns within reason, but there are many more sets of filter conditions, which was the undoing of a few other solutions I cobbled together; 16-32 helper columns would not be accepted by the group I'm trying to develop this for.
If your excel version supports the newer MAXIFS function, use that with the ABS function and MINIFS function.
=max(maxifs(d:f, a:a, 2011, b:b, "<>", c:c, 1), abs(minifs(d:f, a:a, 2011, b:b, "<>", c:c, 1)))
If not then AGGREGATE will provide the conditions.
=AGGREGATE(14, 6, ABS(D1:F6)/((A1:A6=2011)*(B1:B6<>0)*(C1:C6=1)), 1)

How to find values in one column in another column with multiple values

I have an excel like
A B START DATE END DATE
1 10 01-jan-2016 02-jan-2016
2 11 01- jan-2051 02-feb-2061
3 1 04-mar-2016 07-mar-2016
4 1 08-mar-2016 10-mar-2016
5 5 01-mar-2016 03-dec-2016
6 5 03-nov-2016 31-dec-4712
I am new to excel. I want to highlight or extract the columns in A column which can be found in B Column along with the start date and end date .
That is result should be like :
A start_date end_date
1 04-mar-2016 07-mar-2016
1 08-mar-2016 10-mar-2016
5 01-mar-2016 03-dec-2016
5 03-nov-2016 31-dec-4712
Can anyone pls suggest something ?
In E2 enter:
=IF(COUNTIF(A:A,B2)>0,"X","")
and copy down. Then filter the table
You can hide any un-wanted columns after that.

How to count the values in ranges in Excel

I have two columns as shown below. Group values is 0,1,2,3,4 and scores is from 0 to 80. I want to count how many 0s (1s, 2s, 3s, 4s) are present for scores between 0 and 10; 10 and 20; 20 and 30 etc.
I am thinking to use Excel pivot table. But I am stuck - how could I achieve this?
Group scores
1 8.56163
2 34.3649
2 12.2291
0 8.75357
2 8.75967
2 5.87806
0 9.33751
2 32.0303
0 43.5567
2 11.1044
2 24.9266
1 18.9314
-------- result should look like below --------
scores group count
0-10 0 2
0-10 1 1
0-10 2 2
0-10 3 0
0-10 4 0
10-20 0 0
10-20 1 1
10-20 2 2
...
------ PS I have solved this problem using matlab. But it would be nice to see someone do it in Excel.
---------------- thanks for all the anwers. I really appreciate it. I have accepted the 1st answer.
I apologize for my previous answer. You can do binning with PivotTable.
select your whole two columns (A1:B13), insert PivotTable
under rows, put your "Group"
under columns, put your "scores"
under values, put your "Group"
click that last one ("Group" within the values quadrant) and change it to count, not sum
intermediate result:
Now in the resulting pivot table, right click on a colum and select "Group and show detail". You can configure your bins there.
Result:
One option is to use a pivot table, but another option is to use COUNTIFS, e.g.:
=COUNTIFS($A$2:$A$13,"="&$F2,$B$2:$B$13,">="&D2,$B$2:$B$13,"<="&E2)
In practice:
You could just use simple countif formulas:
Type out first criteria into cells. D1 = 0, E1 = 1, F1 = 2 etc.
Now you can just say =COUNTIF($A$2:$A$13,D1) and just drag that out.
The other column would require countifs.
Lets say D3 is blank E3 = ">10", F3 = ">20", etc.
Now D4 = "<=10", E4 = "<=20", F4 = "<=30", etc.
Now you can use =COUNTIF($B$2:$B$13,D4) for your first criteria and =COUNTIFS($B$2:$B$13,E4,$B$2:$B$13,E3) for the next criteria and just drag that out.
Hope this helps, good luck!
Please try:
This uses Grouping (by decade) for the Row labels.
To Group, right-click on one of the entries under Row Labels and Group..., then select enter Starting at:, Ending at: and By: to suit:

Finding the first specific value above a certain cell

I'm looking for a way to find the first specific value above a certain cell.
Using the example below, in the result column every time I hit a A in COL2, I need to substract the value in COL1 to the first A value above.
The trouble seems finding a way to keep the range dynamic...
I thought of =IF(B5="A";A5-INDIRECT("A"&MATCH("A";B:B;0));"")
But of course that only works for the first one as Match will always pick up the first one.
Any ideas? Thanks!
Example :
COL1 COL2 Result
1 A
2 0
3 0
4 A 4 - 1 = 3
5 0
6 A 6 - 4 = 2
7 0
8 0
9 0
10 A 10 - 6 = 4
Try this:
=IF(AND(ROW(B2)<>2,B2="A"),A2-INDEX($A$1:$A1,AGGREGATE(14,6,ROW($1:1)/($B$1:$B1="A"),1)),"")
The AGGREGATE() Function was introduced in 2010.
In D2 enter =IF(B2="A",A2-INDIRECT("A"&MATCH("A"&(E2-1),F:F,0)),"")
In E2 enter =IF(B2="a",COUNTIFS($B$2:B2,"a"),"")
In F2 enter =B2&E2
Copy formulas from D, E and F down all your rows
Column D is the result you're looking for

Excel 2013 complex countif formula

I have a source sheet set up like this:
Days Open Month
10 1
4 1
6 1
2 1
4 2
2 2
-1 2
4 3
6 3
7 4
3 4
etc
I'm trying to set up a formula to count rows based on the following criteria:
cells in Days Open column <=5 and <>-1 where the month is either 2, 3, or 4 (the worksheet will eventually have month numbers up to 12, and I need to group results quarterly). The total must then be divided by the total of ALL rows in which 2, 3, or 4 appears in the Month column.
I can't seem to get the first part of the COUNTIFS to work with both criteria... this is what I have so far that I'm trying to make work:
=COUNTIFS('Cumulative Complaints'!K:K,"<=5",'Cumulative Complaints'!K:K,"<>-1")/(COUNTIF('Cumulative Complaints'!L:L,"2")+COUNTIF('Cumulative Complaints'!L:L,"3")+COUNTIF('Cumulative Complaints'!L:L,"4"))
I've been looking around here and other excel forums and think maybe SUMPRODUCT is the way to go? I haven't been able to get that to work though, given the criteria needed on the Days Open column (<=5 and <>-1).
Try this SUMPRODUCT() FORMULA:
=SUMPRODUCT(('Cumulative Complaints'!K:K<=5)*('Cumulative Complaints'!K:K<>-1)*('Cumulative Complaints'!L:L>=2)*('Cumulative Complaints'!L:L<=4))/SUMPRODUCT(('Cumulative Complaints'!L:L>=2)*('Cumulative Complaints'!L:L<=4))
When using the SUMPRODUCT the condition AND is replaced with the *. It requires all four conditions to be True to return a 1; 1*1*1*1 = 1 if any are false they return 0 so 1*1*0*1 = 0. So as it iterates through the rows it returns a 1 or a 0 to the be added to the sum.
Wrapping a COUNTIF or COUNTIFS function in a SUM function allows you to use an array of constants as OR citeria.
=SUM(COUNTIFS('Cumulative Complaints'!K:K, "<>"&-1,'Cumulative Complaints'!K:K, "<="&5,'Cumulative Complaints'!L:L, {2,3,4}))/SUM(COUNTIF('Cumulative Complaints'!L:L, {2,3,4}))
This is not an array formula and does not require CSE.
My answer would be to take a different approach.
Excel has a very powerful feature called Pivot Tables, and I think it might be a good fit for your problem and other similar problems you may face.
First, I would add a couple columns to your table, like so:
Days Open Month Quarter RecentlyOpened
10 1 1 FALSE
4 1 1 TRUE
6 1 1 FALSE
2 1 1 TRUE
4 2 1 TRUE
2 2 1 TRUE
-1 2 1 FALSE
4 3 1 TRUE
6 3 1 FALSE
7 4 2 FALSE
3 4 2 TRUE
The formula for Quarter is: =CEILING(B2/3,1)
The formula for RecentlyOpened is: =AND(A2<>-1,A2<=5)
Second, select the table, and do Insert > Pivot Table.
Third, drag from the fields to the boxes, like so:
Drag Quarter to the ROWS box
Drag RecentlyOpened to the FILTERS box
Drag Month to the VALUES box
Fourth, click Sum of Month, and select Value Field Settings to change Sum to Count.
Fifth, set the RecentlyOpened filter to TRUE.
The result is this:
Pivot Tables often provide a solution that is more flexible and easier to read and understand versus complex formulas.

Resources