sum if with some conditions - excel

Guys here's what I want to do...
I have 3 columns: category, product and quantity. A product can be in more categories... what I want to do is to sum the quantities for each product in each category... I can do SUMIF looking for the product as a criteria but then it will count it no matter the category... do you have any solution? (I don't want to use a pivot because then it will be simple...)
To give you an example let's say we have 3 categories... t-shirts, pants and shoes and 3 brands... let's say one is nike and we have it in all three categories... I want to sum the quantities of nike pants ... the quanties of nike t-shirts and the quantities of nike shoes... if I do a SUMIF with nike as a criteria it will sum everything no matter what they are.
Thanks!
Here's an example:
Let's say we have the following table
I want the following result

Depends on what you want to be simple. Like Brett said, a pivot table is the easiest to implement.
Another solution is to use SUMPRODUCT. The below would find the matches for Category A Product 1.
=SUMPRODUCT(--(A2:A11="A"),--(B2:B11=1),C2:C11)
SUMPRODUCT is well outside of easy I'd say.

A basic PivotTable will produce this summary for you
I suggest you see Debra Dalgleigh's site here for the background info - it won't take long to create

Related

Is there a way I can count a specific string (Product) in a column times by the neighboring cell (Quantity) so show how much of a product I have sold [duplicate]

I'm wondering if there is an easy way to do what I'm looking for. Basically, I have a balance sheet in Excel 2011 with a bunch of data. One specific piece of information I always want visible is the amount that hasn't been reimbursed. In other words, I have a column for the amount paid and another for whether or not it has been reimbursed (Yes/No). I want to sum all of the amounts paid where the reimbursed field is equal to 'No'.
I recognize I can sum the entire column and filter out those that have been reimbursed, but I'd like it to display the full amount regardless of what filter is on (or if no filter is on).
I wasn't able to find good keywords to describe this to Google, so I'm asking here. I would like to accomplish this in Excel, not in an external program or script.
If column A contains the amounts to be reimbursed, and column B contains the "yes/no" indicating whether the reimbursement has been made, then either of the following will work, though the first option is recommended:
=SUMIF(B:B,"No",A:A)
or
=SUMIFS(A:A,B:B,"No")
Here is an example that will display the amounts paid and outstanding for a small set of sample data.
A B C D
Amount Reimbursed? Total Paid: =SUMIF(B:B,"Yes",A:A)
$100 Yes Total Outstanding: =SUMIF(B:B,"No",A:A)
$200 No
$300 No
$400 Yes
$500 No
You could do this using SUMIF. This allows you to SUM a value in a cell IF a value in another cell meets the specified criteria. Here's an example:
- A B
1 100 YES
2 100 YES
3 100 NO
Using the formula: =SUMIF(B1:B3, "YES", A1:A3), you will get the result of 200.
Here's a screenshot of a working example I just did in Excel:
You should be able to use the IF function for that. the syntax is =IF(condition, value_if_true, value_if_false). To add an extra column with only the non-reimbursed amounts, you would use something like:
=IF(B1="No", A1, 0)
and sum that. There's probably a way to include it in a single cell below the column as well, but off the top of my head I can't think of anything simple.

How to count pairs of cells in alternate rows

I am preparing a weekly time-table for my school which looks like the following
The even rows contains course names, whereas the odd rows contain the teacher initials. Observe that a same paper is taken by more than one teacher (e.g., C10 C11 and G10 G11). I need to count the total number of classes per course per teacher in a week. Please help me to achieve that.
My efforts so far have been very inefficient.
I calculated the formula in B71 for each row in the entire time-table and added all the quantities in B70. However I need to have a comprehensive list of all courses with divisions for all teachers. I am not being able to generate that.
Thanks in advance.
You where pretty close in your attempt. You could use the following in B70 and fill down and to the right:
=COUNTIFS($C$10:$P$67,$A70,$C$11:$P$68,B$69)

How to sum through two tables in Excel

I am looking for help to sum values in a table using a mapping table..
Tried Xlookup and sumif. Not sure where I am going wrong.
Simplifying it in an example
Basically, I have two tables.
Food type
Food
Fruits
Apple
Fruits
Orange
Vegetable
Spinach
Vegetable
Fenugreek
Food
Cost
Apple
$10
Orange
$15
Spinach
$20
Fenugreek
$10
So, if my input is Foodtype = Fruits, then I should get an answer of $25 (as it will sum up Apple and Orange)..
The combination of sumifs and xlookup is only giving one answer ($10) whereas I need $25.
please let me know.
I cannot combine the tables, as I have to use the first mapping table in multiple places.
Thankyou!
You can try:
=SUM(SUMIF(E2:E5,FILTER(B2:B5,A2:A5=I2),F2:F5))
This uses XLOOKUP and SUM.
=SUM(XLOOKUP(FILTER($B$2:$B$11,$A$2:$A$11=G2),$D$2:$D$5,$E$2:$E$5))

How to rank Revenue based on multiple Criteria. MS Excel

So I have this data set and I want to rank the revenue of some hotels based on multiple criteria.
So the columns look like this.
Day(1-31) EUCountry Hotels(1-12) Revenue(0-100k)
2 DE 3 34,120
6 FI 6 60,358
...
...
(and so on...)
And I want to calculate the rank of each Hotel within each EUCountry for
each Day in terms of Revenue (In a new Columns so it has to be a formula)
.
Any Ideas on how should I do this???
Any help would be grateful
You could use the COUNTIFS forumla as a kind of "RANK_IF" formula. See e.g. this example: https://exceljet.net/formula/rank-if-formula . This is an alternative tutorial: https://excelchamps.com/blog/conditional-ranking-sumproduct-rank-if/
Hope that works!

Subquery in excel? How do I add the classification of one row to other rows with same ID?

My brain is on a ministrike, please advice.
So far Ive only been able to solve this with vlookup and pivot table. But I want a better solution than pivot.
I have two rows.
A- unique ID.
B- Purchase history of bags
Same client appears several times with different purchases.
If a client has a bag called X, I want to classify it as important for all purchases.
So where I have question marks I want "important" written.
=IF(SUMPRODUCT(($A2=$A$2:$A$4)*($B$2:$B$4="x"))>=1,"Important","Does not buy enough")
Now this is based on the assumption that the client only needs to purchase a least one x for the clients other purchases to flagged as important.
you could also probably achieve this with a straight COUNTIFS which would avoid the array calculations that SUMPRODUCT does.
UPDATE:
COUNTIFS solution
=IF(COUNTIFS($A$2:$A$4,$A4,$B$2:$B$4,"x")>=1,"Important","Does not buy enough")

Resources