Excel Summation of Multiple Conditional Maximum Values - excel

I am working on getting pricing based on the number of units we are ordering using Excel sumifs. The data I have looks something like this:
A B C D
Item1 Comp1 1 4.99
Item1 Comp1 10 3.99
Item1 Comp1 100 2.99
Item1 Comp2 1 13.99
Item1 Comp2 100 10.99
Item1 Comp3 1 2.99
Item1 Comp3 10 2.59
Item1 Comp3 50 2.19
Item1 Comp3 100 1.99
... ... ... ...
Where column A is the main item, column B is the individual components of the item in column A, and column C is the number we need to order in order to get the price listed in column D.
In a separate sheet, I have the following table:
A B C
Item1 10 FORMULA
Item2 5 FORMULA
Item3 20 FORMULA
... ... ...
The point of this sheet is to have the Item name as seen in Column A of the first table, column B holds the number we need to order, and column C (hopefully) lists the total price by adding all the components at their respective price breaks.
In this example, the sum for Item1 I am looking for is 3.99 + 13.99 + 2.59 = 20.57 because 10 items gets the 10 price break for component 1, the 1 price break for component 2, and the 10 price break for component 3.
So far I am able to sum the cost based on the item name in column C:
=SUMIFS(Table1[D], Table1[A], "="A2)
I am having trouble starting the second part which is basically only summing the maximum price break for each component where Table1[C] <= B2.

Related

Aggregating variables with similar first digit

In the table below each item has a 2-digit code. The first digit signifies a category.
I want to aggregate the items with the same first digit per person using Stata. Thus, the solution will be:
In this table, item1 = item11+item14+item15+item17 and item2=item21+item25 that are calculated per person.
clear
input str1 person item11 item21 item14 item15 item25 item17
a 2 3 5 1 3 50
end
egen item1 = rowtotal(item1*)
egen item2 = rowtotal(item2*)
drop item1? item2?
list
+------------------------+
| person item1 item2 |
|------------------------|
1. | a 58 6 |
+------------------------+

count if field in another list SharePoint

I have 2 SharePoint lists like below
I want to make a column in list B to count if this item listed or not in specific column in list A
list A
items
item1
item4
item6
list B
items Count in list A
item1 1
item2 0
item3 0
item4 1
item5 0
item6 1
item7 0
item8 0
How to do this ??
You could create a LOOK UP column in list B,and get information from list A,there is a count attribute of look up column that can be used.
Complete example for your referenceļ¼š
https://wonderlaura.com/2013/08/06/sharepoint-column-count-related-items/
Updated:

Change array of SUMIF in case criteria exists in two different columns

A B C D E F
1 Results List A List B
2 Campaign Sales Campaign Sales Campaign Sales
3 Campaign_A 1.510 Campaign_A 500 Campaign_B 50
4 Campaign_B 120 Campaign_A 450 Campaign_B 40
5 Campaign_C 90 Campaign_A 560 Campaign_B 30
6 Campaign_D 1.650 Campaign_B 700 Campaign_C 80
7 Campaign_E 100 Campaign_B 710 Campaign_C 10
8 Campaing_F 70 Campaign_C 200 Campaign_F 70
9 Campaing_D 850
10 Campaing_D 800
11 Campaing_E 100
12 Campaing_F 320
13 Campaing_F 360
14 Campaing_F 290
15
16
The Excel table above consists of:
List A = Column C:D
List B = Column E:F
In each list campaigns can appear mutliple times.
In Column A:B I want to sum up the sales per campaign from the two lists using the SUMIF formula:
=SUMIF(C:C,A3,D:D)
=SUMIF(E:E,A3,F:F)
However, the List B should be prioritized over List A which means in case a campaign exists in List B (Column E) the SUMIF function should be only applied to List B and List A should be totally ignored.
The formula might look something like htis:
IF campaign exists in Column E then SUMIF(E:E,A3,F:F) else SUMIF(C:C,A3,D:D)
How can I achieve the desired results in Column B?
Or,
=IF(COUNTIF(E:E,A3)>0,SUMIF(E:E,A3,F:F),SUMIF(C:C,A3,D:D))
I would try with the following:
if(sumIf(E:E,A3,F:F)>0;sumIf(E:E,A3,F:F);sumIf(C:C,A3,D:D))

excel multiple criteria and transform horizontaly to verticaly

I have unique number of items and invoices, but one invoice can have multiple items.
A B C D
1 Invoice Items
2 1 10
3 2 20
4 1 30
idea is sort it to horizontaly via this formula
=IFERROR(INDEX($B$2:$B$8;SMALL(IF($D$2=$A$2:$A$8;ROW($A$2:$A$8)-ROW($A$2)+1);COLUMN(A1)));"")
result:
A B C D E F
1 Invoice Items Invoice Item1 Item2
2 1 10 1 10 30
3 2 20
4 1 30
But my geal is setup results horizontaly:
A B
1 Invoice Items
2 1 10
3 1 30
4 2 20
Is that even possible ?
Is your goal actually to sort on Invoice first and then on Items? If so, why just not using sort on two levels using the build in option?
Input:
Sort:
Output:
It's in Dutch but you'll get the idea :)

SUMIFS across multiple sheets

So I'm working on a workbook right now that is across 3 sheets, 'Data', 'RAW', 'Lookup'. On the Data tab it looks like, Sheet 1
A B C D E
Segment Ranking Amount Revenue Spend
Carbon 15 2 5000 550
Oxygen 30 3 6895 450
Minerals 45 1 4400 350
The Code I use for each column are as follows (Some of the Columns are named columns)
B =IF(NOT(ISERROR(SEARCH("OK",$A2))),SUMIFS(RAW!B:B,Output,"*"&INDEX(SegmentID,MATCH($A2,SegmentName,0))&"*"),SUMIFS(RAW!B:B,Output,"*"&INDEX(SegmentID,MATCH($A2,SegmentName,0))&"*",Output,"<>*OK*"))
C =IF(NOT(ISERROR(SEARCH("OK",$A2))),SUMIFS(RAW!C:C,Output,"*"&INDEX(SegmentID,MATCH($A2,SegmentName,0))&"*"),SUMIFS(RAW!C:C,Output,"*"&INDEX(SegmentID,MATCH($A2,SegmentName,0))&"*",SegmentName,"<>*OK*"))
D =IF(NOT(ISERROR(SEARCH("OK",$A2))),SUMIFS(RAW!D:D,Output,"*"&INDEX(SegmentID,MATCH($A2,SegmentName,0))&"*"),SUMIFS(RAW!D:D,Output,"*"&INDEX(SegmentID,MATCH($A2,SegmentName,0))&"*",Output,"<>""OK"))
E =IF(NOT(ISERROR(SEARCH("OK",$A2))),SUMIFS(Spend,Output,"*"&INDEX(SegmentID,MATCH($A2,SegmentName,0))&"*"),SUMIFS(Spend,Output,"*"&INDEX(SegmentID,MATCH($A2,SegmentName,0))&"*",Output,"<>*OK*"))
The RAW Sheet looks like (Sheet 2)
A B C D E
Output Ranking Amount Revenue Spend
Random_1234_Random 15 2 5000 550
Random_5678_Random 30 3 6895 450
Random_9102_Random 45 1 4400 350
Random_555_Random 60 4 4000 300
The Lookup Sheet Looks like (Sheet 3)
A B
Segment ID
Carbon 1234
Oxygen 5678
Minerals 9102
Carbon 555
The problem that I have right now is, it will only grab the first Carbon with ID 1234, and not grab the second Carbon with ID 555 at all resulting in:
A B C D E
Segment Ranking Amount Revenue Spend
Carbon 15 2 5000 550
The end result that I would like is for it to grab ALL Carbon with any ID and add all of them together as below into a single line. (RAW sheet, Random_1234_Random + Random_555_Random)
A B C D E
Segment Ranking Amount Revenue Spend
Carbon 75 6 9000 850
Any help would be great and if I need to provide more detail please let me know!
Thank you in advance,
Maykid

Resources