Excel formula that returns sum based on categorical and date data from 2 columns? - excel

I have a dataset in excel that looks like this:
Supplier Date QTY
A 03/02/2018 10
A 05/01/2018 15
A 08/06/2018 30
B 02/01/2018 20
B 04/01/2018 50
B 08/01/2018 40
B 08/15/2018 50
B 10/01/2018 60
C 03/09/2018 25
C 04/08/2018 25
C 05/20/2018 25
And I want to make a spreadsheet that allows the user to enter start and end dates and the Supplier name and be able to see a total quantity of items received in that time period from that supplier.
I've tried using a combination of VLOOKUP and SUM, but I've only been able to get the first result of the quantity associated with that supplier to return. I understand that this is the nature of VLOOKUP--to only return one value. I'm pretty new to Excel so I just don't really even know which function(s) would be best to use in this scenario.
Example Output:
Enter Supplier: "B"
Enter Start Date: "03/01/2018"
Enter End Date: "09/01/2018"
Items Received: 140

Try:
=SUMPRODUCT((A2:A12=F1)*(B2:B12>=F2)*(B2:B12<=F3)*(C2:C12))
Result:

Related

Excel formula to find Max and return a column from the matching row

My data looks some thing like this:
Product 1
Date
Site1_Sales
Site2_Sales
Site2_Sales
x1
1-Jan
100
200
300
x2
2-Jan
60
51
150
X1
2- Jan
110
30
40
There will be 1000s of rows with repeated Product but with unique dates. This is what I would like to find:
What was the Max sales for a product ? and on which date ? I tried using Maxifs but it ends up with value error it looks it can handle only continuous ranges.
What was the sum of sales for a product for specific period e.g first 10 days ?
Any help is really appreciated. Thank you
see “Remarks” about #value error:
https://support.microsoft.com/en-us/office/maxifs-function-dfd611e6-da2c-488a-919b-9b6376b28883
SUMIF works in the same way as MAXIF (e.g. you could use a start date and end date as multiple criteria)
FILTER should help you to find the date(s) of max. Sales as well

Display the 3rd highest value of each week

I have Data with a Price Column and a Week Column and I want to display the 3rd lowest price for each of those weeks. I know about the Large function and am assuming that there is a way to combine array formulas with that to receive the wanted results but am stuck on that thought.
Setup:
Week| Price
01 100
01 300
01 200
02 500
02 300
02 600
I want to automatically have the 3rd best price for each of those weeks available so Week 1 : 100 and Week 2: 300, keep in mind that each week has way more pricepoints than 3.
If anything is unclear feel free to ask.
Let's suppose your data would fill a table A1:B6.
In column C write the following formula:
=SUMPRODUCT(($A$1:$A$6=A1)*(B1<$B$1:$B$6))+1
This will rank all the values in column B based on the same value of column A. You will end up with the following table:
1 100 3
1 300 1
1 200 2
2 500 2
2 300 3
2 600 1
All you have to do is to take the rank=3.

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 calculate workdays and compensation for given period based on Employee's monthly salary?

I have only three editable fields:
salary = 15,000
start date = 18 Jul 2014
end date = 12 Oct 2014
With these fields, I need to calculate the total salary I need to pay. Payment is on a monthly basis:
(JULY = 15,000 / 31 * 14) +
(AUG = 15,000 / 31 * 31) +
(SEPT = 15,000 / 30 * 30) +
(OCT = 15,000 / 30 * 12).
I can get total days based on both dates (ie 87 days, =DAYS($enddate,$startdate)+1) ) but I need to split the days according to the months.
What formula do I need automatically to get the amount, because each person will have different salary and different dates?
You can use Excel VBA custom Function to solve your problem:
1). First, you should populate Excel Worksheet with data structure reflecting Employees Name, Monthly Salary, StartDate and EndDate, like in the following sample:
Employee M.Salary Start Date EndDate
John $15,000.00 7/18/2014 10/12/2014
Ann $20,000.00 7/19/2014 10/13/2014
Peter $16,000.00 7/20/2014 10/14/2014
Jeff $25,000.00 7/21/2014 10/15/2014
2). The DAYS in date range can be simply found by subtraction (EndDate-StartDate), because the underlying data type in integer
3). For general solution to the problem (Calculate the compensation for any arbitrary period and monthly salary) you will need to create custom VBA formula and use it in a separate column for each Employee. Refer to this article for explanation: Create a custom worksheet function in Excel VBA
4). Pertinent to your particular case with fixed date rage, the simplified solution based on the Excel Worksheet formulas (no VBA) is described below:
Employee MoSalary Start End Days FullMo FirstMo LastMo Total
John $15,000.00 7/18/2014 10/12/2014 87 30000.00 $6,774.19 $6,000.00 $42,774.19
Ann $20,000.00 7/18/2014 10/12/2014 87 40000.00 $9,032.26 $8,000.00 $57,032.26
Peter $16,000.00 7/18/2014 10/12/2014 87 32000.00 $7,225.81 $6,400.00 $45,625.81
Jeff $25,000.00 7/18/2014 10/12/2014 87 50000.00 $11,290.32 $10,000.00 $71,290.32
4a). In column E starting with row 2 add formula for DAYS : =(D2-C2)+1 and extend it for entire range
4b). In column F starting with row 2 add formula for whole months : =2*B2 and extend it for entire range
4c). In column G starting with row 2 add formula for the first month : =14*B2/31 and extend it for entire range
4d). In column H starting with row 2 add formula for last month : =12*B2/30 and extend it for entire range
4e). In column I starting with row 2 add formula for total compensation : =SUM(F2:H2) and extend it for entire range
Hope this will help. Best regards,
I have split this out because I am not entirely sure what you require and you may be able to assemble the pieces in a way that better suits you:
Assuming your data is in A1:A3, put 1/7/14 in C1, 1/8/14 in D1, 1/9/14 in E1 and 1/10/14 in F1.
To count the number of applicable days by month, in C2 enter:
=IF(MONTH($A2)=MONTH(C1),EOMONTH(C1,0)-$A2+1,IF(MONTH($A3)=MONTH(C1),DAY($A3),EOMONTH(C1,0)-EOMONTH(C1,-1)))
To compute the salary for the month by computing the daily rate for the applicable month and multiplying that by the number of days from above, in C3 enter:
=$A1*C2/(DAYS(EOMONTH(C1,0),C1)+1)
Format C2:C3 to suit and copy across to F2:F3.

How to vlookup on 2 columns and return total value of another?

I've got a table in Excel which is structure like so:
Month Date Time ID Name Currency Value
Jan 07/01/14 5 1234567 Ted GBP 500
Jan 10/01/14 12 1234567 Ted GBP 723
Feb 23/02/14 6 9877654 John GBP 300
Feb 10/02/14 10 1234567 Ted GBP 333
What I need to do is write a formula which basically returns be the total of Value where ID and Month are equal to whatever the lookup values are. For example, using the above I would say:
Find the total of Value where Month equals Jan and ID equals 1234567.
The answer in this case would be 1223.
Ive just tried
=SUMIFS(INPUT!H:H,INPUT!D:D='TRANS BY MID'!B2,INPUT!A:A='TRANS BY MID'!C1)
INPUT!H:H is my ID column
INPUT!D:D='TRANS BY MID'!B2 is the ID I want to use
INPUT!A:A is the Month column
TRANS BY MID'!C1 is Jan
To provide a working solution I simplified your question into one sheet. The data appears like this:
You can link your other sheet to the values shown in column J.
The formula is now this:
=SUMIFS(G:G,D:D,J1,A:A,J2)
The result is shown in J7:

Resources