Get each price per month for a category? - excel

I have data with the entities date, name, price. I managed to get distinct categories in the Categories colume for each name with = LEFT(B2;FIND(" ";B2)). In fact I want to get for each categorie the summed up monthly prices per month.
My sheet:
I tried:
=SUMIF(B2:B6;LEFT(B2;FIND(" ";B2));C2:C6)
However, this formula returns 0 and also does not give me the prices per categorie and per month.
I really appreciate your help!!!

If you want a sum on each row which will sum for the category of the current row and the month of the current row you can use SUMIFS like this
=SUMIFS(C:C;E:E;E2;A:A;">"&EOMONTH(A2;-1);A:A;"<="&EOMONTH(A2;0))
SUMIFS requires Excel 2007 or later

=SUMIF(E:E,E2,C:C) will sum the categories for you
I think if you want to sum categories by date, you might want to use a Pivot Table or write a Macro
You can write a =sumif function with multiple criteria but I'm not sure how you would define the "date rage" for each new criteria

Related

Pivot Table get value from previous month

I have a pivot table with the rows: Product and **Date ** (which shows the months) and values of: Sum of Starting, Sum of InTransit, Sum of Ending, all show inventory levels.
In the inventory report that I receive monthly, the Starting value is incorrect since it doesn't include the inventory which is InTransit. I would like to create a calculated field which will show the true inventory levels, it should add the Sum of InTransit value of the previous month to the current month Sum of Starting value. Another calculated field for the true end of month inventory, should sum the Sum of InTransit + Sum of Ending of the current month, but this is quite straightforward. I tried the function previousmonth, OFFSET, none seems to work.
Would truly appreciate your help!
Thanks!
Pivot Table
Pivot Table Fields

How do I create a function to calculate the average of filtered rows in Excel

I would like a formula to display the average from the filtered values in Excel. For example, I have a data with 4 columns. Column A-Product, Column B-Week, Column C-number of unit tested and Column D-Yield. In column A, I have hundreds of product that could belongs to several group. As of now, I have created another column Average showing the average yield value for each product by using the AVERAGEIF function "=AVERAGEIF([Product],[#[Product]],[Yield])".I manage to get the average yield value for each products.
But now, I want to randomly group few products and see the average value. The group should not be pre-determined. For example, I want to select X3000, A and AL using the filter function. The formula should give me the average for this three products which is 0.6786 not the average of individual product. The same formula should work if I want to select only product X3020 and A by using the filter function in Excel.
This is the example of data that I'm working on right now.
PRODUCT|WEEK|#TESTED|YIELD|AVERAGE
X3000|WEEK-12|2|100%|1
X3000|WEEK-13|1|100%|1
X3020|WEEK-6|7|71.43%|0.7712
X3020|WEEK-10|11|82.81%|0.7712
A|WEEK-12|7|0%|0.6667
A|WEEK-13|2|100%|0.6667
A|WEEK-14|1|100%|0.6667
AL|WEEK-7|16|75%|0.3750
AL|WEEK-9|2|0%|0.3750

Subtract two cells based on multiple criteria

I'm trying to calculate a daily count, given that I have current date, city, and total count.
For each row, I imagine [city's current total] - [the previous total for that city] = the daily count.
Not all cities exist in every date. The number of rows may vary between dates for each city.
I've tried INDEX and MATCH with VLOOKUP, but don't Excel functions well enough.
I'm familiar with arrays, but can't figure how to pluck the UBOUND and UBOUND-1 counts based on the date + city criteria. Ideas?
In E2204 put:
=D2204-INDEX(D:D,AGGREGATE(14,7,ROW($D$1:$D2203)/($C$1:$C2203=C2204),1))
OR if one has the formula XLOOKUP:
=D2204 - XLOOKUP(C2204,$C$1:$C2203,$D$1:$D2203,0,0,-1)

DATESYTD returns no value

I have a "sales" table containing all sales data and created a measure:
Total Sales = SUM(std_adi[Nettopreis])
this works fine in power pivot.
Now I want a DATESYTD() measure and used:
Total Sales YTD = CALCULATE([Total Sales], DATESYTD(Dates[Date]))
but when I add this into the power pivot sheet, it contains "no value"
My "Dates" table has a column "Date" and has a relationship to the std_adi table, column order_date (which contains my sales data)
Am I missing something? I have the above DATESYTD formula from a book and looks identical to all the examples on the net
Even if I change the measure to:
=CALCULATE(SUM(std_adi[Nettopreis]), DATESYTD(Dates[Date]))
it contains "no value" which leads me to the point that something with the Dates Table might be wrong, but I can't find anything
It won't have a value unless you slice / filter your pivot by year.
If it still doesn't work check that your Dates table is marked as a Date table. Check that you have a date for every day in the timeframe you are looking at. And check that you can slice your Total Sales measure by Year from your Date table.
Your formula is fine.

Spread values across rows based on codes

I have two tables (1.Purchase order and 2.The invoice) and I want to spread the quantity from the invoice table to the purchase order invoice quantity column by code but I want to match the exact quantity from the purchase order quantity.
Here is how the table looks now:
Purchase order table and Invoice table
And this is how i want it to look:
In this post a formula was suggested
=MAX(MIN(M$2-SUM(E$1:E1), D2), 0)
which I customized to use vlookup so it can match the code,
=MAX(MIN(VLOOKUP(A2,J:M,4,FALSE)-SUM(E$1:E1), D2), 0)
but that doesn't work.
#Jeeped suggested to use AGGREGATE function for a one column conditional match, but can anyone give me an example related to this situation?
Here is the sample Excel file
Thank you!
In E2 as,
=MAX(MIN(VLOOKUP(A2, J:N, 4, FALSE)-SUMIFS(E$1:E1, A$1:A1, A2), D2), 0)
What happened to row 1?

Resources