I am trying to write a formula that will count unique values (both text and numbers) in a range that also has blank fields with a set of criteria.
Criteria:
Shipment Type = Specific Transport Type
Status Column = "Unplanned"
Despatch Month = Specific Month
This is very easy to execute with a pivot table. However I want to be able to write a formula instead, as I don't like the idea of having to refresh a pivot table every time new data is added.
Here is the formula I have written for Unplanned Shipping by Cost for Truck 2018-03 in cell I15:
=SUMIFS($F:$F,$C:$C,I$14,$A:$A,$H15,$B:$B,"Unplanned")
The same logic doesn't really apply when writing a =COUNTIFS formula to measure unique consignments as the unique values with blanks fields adds a layer of complexity.
to count the number of record where D:D is not blank:
write in cell I7 =countIFS($D:$D,"<>"&"",$C:$C,I$6,$A:$A,$H7,$B:$B,"Unplanned")
Related
I am trying to create a calculation table for prices based on QTY and price break tier. I have an IF formula that doesn't seem to be working correctly and could use some help! Below I will post a screenshot of the table, the formula I am using, and amplifying details:
Price Break formula: =IF(H3<=24,C3,IF(25<=H3<=99,D3,IF(100<=H3<=499,E3,IF(500<=H3<=999,F3,IF(1000<=H3,G3)))))*H3
Amplifying Info: Column "H" is derived from a sum of "J:P". What I want to do is automatically calculate the total quantity requested (Column "H") and based off of that value calculate the total price of each item in Column "I". IE if the total QTY=1 the price would be 1xC (Associated cell C3:C14); If the QTY=600, then it would be 600xF. Currently the formula only works if I manually input "1" as the QTY and no other numbers work. Column "H" is set as number (though general did the same thing). If i place any other number or what the calculation comes out to it puts a dash as shown in the picture.
I'm not sure if there is better way to do this with VLOOKUP or another function?
Try using MATCH and CHOOSE:
=CHOOSE(MATCH(H2,{0,25,100,500,1000}),C2,D2,E2,F2,G2)*H2
The MATCH will compare the qty (in H2) to the values in the array ({0,25,100,500,1000}) and return a number (1 to 5).
The CHOOSE will then take this number and choose the nth value from the list of cells (C2,D2,E2,F2,G2)
We then multiply the value in the chosen cell by the quantity in H2
I'm new to excel and I came across this problem.
I have a table with 2 columns one with the name of the item(the same name can appear multiple times) and next to it the quantity of said item.
What I want to get is the item which has the most overll quantity (keeping in mind that the object can appear multiple times in the table and have different quantities in each of the apppearences).
You didn't specify how you want to highlight the value.
Assuming your items are in column A and your values in column B.
Add a helper formula in column C to sum all the items.
=SUMIF($A$1:$A$100,A1,$B$1:$B$100)
you can use conditional formatting to highlight the highest value by adding a rule that uses a formula and entering;
=B1=MAX($C$1:$C$100)
It highlights every entry of the item with the greatest value.
To return the name of the item with the highest value you can use;
=INDEX(A1:A100,MATCH(MAX(C1:C100),C1:C100,0),1)
There are 2 parts to this formula
=INDEX(A1:A100,MATCH(MAX(C1:C100),C1:C100,0),1)
The match part finds the row number of the highest value and the Index part returns the value in column A for that row.
This solution may not be ideal if you have a huge amount of data so you could also try a pivot table and sort it highest to lowest.
I am new to excel vba. I have a huge set of data for which I have to calculate averages corresponding to each id. Upon search, I came to know that it can be easily done by using excel AverageIf. But I have to calculate average of numbers which are below Threshold for an id.
Below is the screenshot of sample data. For example, when I calculate the average of Price for id 1, I will only consider Price values which are below 70 for average calculation as 70 is Threshold and any value above 70 cannot be included in calculation and same goes for all other ids. I would appreciate any ideas in this regard.
AVERAGEIFS should do the job:
=AVERAGEIFS(B2:B15,A2:A15,1,B2:B15,"<="&C2)
I like the countifs but here is another way using a helper column to determine if to include in average calculation. Assumes data set up as above without repeating Threshold value against each id.
1) Convert your data to a table with Ctrl+T (with a cell in the range selected).
2) In top right cell under header Average put
=IF(B2<INDEX($C$2:$C$13,MATCH(A2,$A$2:$A$13,0)),1,"")
It will autofill down all the rows in that column.
Tailor the ranges to your actual ranges. These ranges match the image below.
3) Select a cell in the table and press Alt + N + V to generate a pivottable and place it by the side of the current table with a 2 column gap.
4) Add id to the rows and price to the Values field. The add Average to the page field and filter on 1. Then right click on price in the Values area and select Summarize value field by Average.
5) You can add more rows to the table and the formula will autocomplete so you only need to refresh the pivot to get new averages.
Note:
You could also have used a lookup table to retrieve the thresholds.
So I have this huge report and I'm looking to analyze it better. I have Data in one work book (1)and I'm creating a separate workbook (2) to reflect certain criteria.
Workbook 1-I have Data in Col A, Col B, Col C.
Column A has abbreviated businesses (ex. Abc, Def, Ghi)
Column B has Dates for everyday of last year and this year (ex.1/3/2017)
Column C has Y or N values.
Workbook 2- In work book 2, I need data from the previous month, of a particular business (Abc) with just values equal to Y
You should make a pivot table that contains the data you want, and then double click the cell containing the data meeting your criteria and it will pull up the source data for only those criteria. That's a pretty simple way to do it.
i.e. Make a pivot table in Workbook 1 with a month filter, a business filter, and a values equal to Y filter.
EDIT:
I took a stab at it without getting your specifics. Images including formula are attached.
Sheet1 contains the data. Sheet2 calculates the sum for the month for each business.
These are array formulas and require you use ctr+shift+enter to confirm the cell. Then you can drag down for month and business as needed.
{=SUM(IF(Sheet1!$A$2:$A$43=A2,IF(Sheet1!$B$2:$B$43>=D2,IF(Sheet1!$B$2:$B$43<=E2,Sheet1!$C$2:$C$43))))}
NOTE: My sheet1 only went down to row 43, hence the $43 in the equation. You'll need to replace those values with your values.
This also assumes that you are using dates down to the day. If you have a column that is for Months, and it's text, then you can nest an IF($B$2:$B$43="January", .... or however you have your months defined.
I have a table where I need to obtain the sum of one column where the values in two other columns match specific criteria.
What I need would be the sum of the Value column where the customer name matches Customer A and the Order Status matches Complete. For this example the result would be £150.00
I am using Excel 2007.
SUMIFS is available in 2007+
first parameter is what values to sum, the subsuiquent pairs are the range and their criteria.
For your example, it would be
=SUMIFS(D:D,A:A,"Customer A",C:C,"Completed")
You could also summarize the whole table using a pivot table.