SUMIF formula to find sum for dates today or earlier - excel

so I have this table of salaries that I make (hypothetically):
A B C D
1 Date salary how_much_I_earned_so_far
2 total =SUM(salaries_until_today)
3 2017-10-1 5000
4 2017-11-1 5000
5 today-> 2017-12-1 5000
6 2018-01-1 5000
7 2018-02-1 5000
8 future.. 2018-03-1 5000
9 2018-04-1 5000
now I want to calculate on D2 the amount of money I have earned so far..
to do that, I want to sum up all the past salaries from C3 all the way down to C_x where x is the index of the line where today < B_x
so that raised me two questions
1) how do I select unknown index of cell? usually when I do formulas it looks like this =SUM(C2:C9) so how can I make the number 9 be variable?
2) can I create variable that depends on a number of lines of where a cell is smaller than a value? I know how to get the current day, its simply =TODAY() but now I want to compare it with all B's and find the index of line where its smaller than it.. how do I start?
I'm sorry if that's a weird question, I'm a programmer and its frustrating me that a simple thing that I could quickly solve by code cannot be accomplished in a sophisticated app such excel..
thanks.

=SUMIF(B:B,"<=" & TODAY(),C:C)

Related

EXCEL formula to sum demand per date when multiple entries of dates exist

How do I sum the amount of demand I have for each date, when there are multiple entries for each date., e.g.
Sheet 1:
A B
Date Demand
13/7/21 5
13/7/21 4
13/7/21 2
15/7/21 6
15/7/21 3
16/7/21 2
16/7/21 4
So I'm trying to get a summary as follows:
Sheet 2:
A B
13/7/21 11
14/7/21 0
15/7/21 9
16/7/21 6
17/7/21 0
I've tried =SUMPRODUCT(--('Sheet 1'!$A$2:$A$240='Sheet 2'!A2),'Sheet 1'!$B$1:$B$240)
I'm not wanting to do a pivot table, as the pivot table does not give me the zero values for dates where there is no data (unless there is a way to show this in a pivot)
You can use SUMIFS() like
=SUMIFS(Sheet1!B:B,Sheet1!A:A,A1)
You can also use SUMPRODUCT() in this way.
=SUMPRODUCT((Sheet1!$B$2:$B$8)*(Sheet1!$A$2:$A$8=A1))
Put together quickly to start you off:
Edit to give text version of the solution to the OP's problem:
=SUMIFS(B6:B12,A6:A12,"="&G12)
Then you can do between by setting lower and upper criteria in the sumifs().

How to sum up to reach a number by date in excel

I would like to make a formula that to do a sum calculation, that confirm which date to start (cell D5), then look for the start point from the row 1, and sum up the row 2 start from the correct date, and then stop the sum up if the amount is equal to or larger than run estimate (cell D6)
the steps should be like this:
I know the start day is 31-May
then I look into the table to find the date 31-May
then I look into the table again, find out the run estimate is 2 hours
I know I have 6 hours run estimate need to be completed
then I add 2 + 3 + 4 = 9 hours to cover the 6-hour estimate
then I know the end date is 2- Jun
I am able to find the start point on the table
=SUMIFS(B2:F2,B1:F1,">="&D5)
but I am not sure how to stop it
and moreover I am not sure how display the final value date, not the total amount..
col B col C col D col E col F
30-May 31-May 1-Jun 2-Jun 3-Jun
1 2 3 4 5
start date 31-May
run estimate 6
expected result should be 2-Jun
enter image description here
anyone can help on this?
Here is a solution that requires one extra row of data, to calculate the sum of run times up until that day: Put this formula in cells B3:F3 (or however many columns you have exactly)
=SUMIF($B1:B1,">="&$D6,$B2:B2)
Then you can find the first value that is equal to or higher than your estimate runtime and use that to offset to the correct date:
=OFFSET(B1,0,IFERROR(MATCH($D6,B3:F3,0)-1,MATCH($D6,B3:F3,1)))

Excel 2010 Sum of Values based on their month value and the current month

I've been looking all over for help with this, but not quite found what I'm looking for.
What I'm trying to do is add up the values of CREDIT (B2:B13) up to the current month and put that value in D2.
A B C D
1 DATE CREDIT TOTAL AS OF TODAY
2 15/01/2015 1000 4000
3 15/02/2015 1000
4 15/03/2015 1000
5 15/04/2015 1000
6 15/05/2015 1000
7 15/06/2015 1000
8 15/07/2015 1000
9 15/08/2015 1000
10 15/09/2015 1000
11 15/10/2015 1000
12 15/11/2015 1000
13 15/12/2015 1000
For example: Lets say the current date is 30th April 2015. Sum all the values in B2:B13 up to today's date based on their date value from the Date column (A2:A13). So D2 should = 4000.
I'm quite new to Excel so please forgive me if this is a stupid question.
Thanks very much in advance for any help.
SUMIF should do the trick (documentation here)
So D2's formula would be:
=SUMIF($A2:$A13,"<"&Today(),$B$2:$B$13)
The first argument is the range you want to test. The second argument is the condition you want to test for. The last argument is the range that you want to add up if the test passes.

How to sum the number of overlapping time frames in excel

Hoping someone can help,
I work for a fire department and i am trying to determine the number of times all our rigs on the road at emergencies at the same time. I have all the data from date, times, etc... So what i am looking for is an excel summation total that would display the sum of overlapping times that were greater than 3. So kinda as follows:
Rig Date Start Time End Time
1 1/1/2015 0703 0759
2 1/1/2015 0705 0823
3 1/1/2015 0706 0815
4 1/1/2015 0723 0759
1 1/1/2015 0802 0845
With more than three rigs on the road after 0723 it would grant me a total of one but then at 0802 rig 1 goes back out again meaning my total would increase by 2 and so on and so on. I dont have the slightest clue as to how to program this. I have three years of data i need to crunch through and something like this would help me greatly. Any help whatsoever is appreciated. Thanks in advance and lets see what you all come up with!
First, you might want to convert the times to Excel date-times (assuming you already applied Format as Table to your data, so all new formulas get populated for all rows automatically):
if the values are already Excel times, use:
=$B2 + C2
if you have integers like "703" (formatted as "0703"), use:
=$B2 + INT(C2/100)/24 + MOD(C2, 100)/24/60
or if you have values-as-text:
=$B2 + LEFT(C2, 2)/24 + RIGHT(C2, 2)/24/60
Don't forget to format the new columns using Custom Number format d.m. hh:ss or m/d hh:ss.
The next step is to count all ongoing deployments that end only after the current deployment started, i.e. use following formula as illustrated on screenshot:
=COUNTIFS(F$2:F2, ">" & E2)
Please make sure that the formula e.g. in row 13 looks like =COUNTIFS(F$2:F13, ">" & E13) to check that you are on the right track. Also none of the values can be 5 or more if you only have 4 rigs, otherwise you have an error in your data.
And to count number of times when all 4 rigs were in use, the formula looks like this:
=COUNTIFS($G$2:$G$13, 4)
In case you also want to sum the time while none rigs were available, add 2 more columns in your table. Column H in my illustration needs following array formula (entered by Ctrl+Shift+Enter):
=IF(G2=4, MIN(IF(F$2:F2 > E2, F$2:F2)), "")
And a normal formula in column I:
=IF(G2=4, H2-E2, "")
Don't forget to format numbers accordingly.
And do a simple sum: =SUM($I$2:$I$13).

Count in Excel over a range using 2 columns of data

Tried looking for an answer first...
I want to count the number of items that were open between 1-7 days, 8-14 days, etc etc (open and closed on same day = open for 1 day)
Is there a way I can count this directly using the 2 columns holding the data without creating a 3rd column for Date Closed - Date Opened +1??
So in this example, what can I use to calculate that the number of 1-7 days items is 2? (Items 1 and 3)
Item # Open Closed
1 01/06/2014 01/06/2014
2 05/05/2014 20/06/2014
3 10/06/2014 16/06/2014
4 08/06/2014 15/06/2014
5 02/06/2014 19/06/2014
Many thanks :o)
One way would be to use the versatile SUMPRODUCT:
=SUMPRODUCT(1*(C2:C6-B2:B6+1>7))
assuming your start date column is B and end date column is C. The second part of the formula will determine all date spans which are larger than 7, and the 1* will convert the TRUE values to 1 in order to sum them up.

Resources