Need help - Excel Formula - excel-formula

I am trying to create a formula in excel that will add up the total weight of delivery.
"I did have an image but it wont let me post it!!!!!"
Col A - Contains Delivery Dates
Col D - Contains Delivery Route Codes
Col E - Contains Site Codes
Col I - Contains total weight for specific site
I need to add up all sites weight on the route (Col D) and enter them in Col J next to the last site delivery of that route.
Hope someone can help!!!!
Cheers

I don't think this is the right site to post this, but okay.
In whatever cell you would like to put the output (Col J?), enter:
=sum(d1:d...)
where d... is the cell number of the last cell that you want to add up to the total.

Related

SUMIF, VLOOKUP and SUMPRODUCT formula

So I have this following spreadsheet.
Shipping WS
Col B is part number, Col C Where to ship. Col J is how many full skid and Col L how many more boxes to be added to full skip. There is a second sheet with the parts details like qty/box, box/skid, skid weight, etc...
Because everyday the is different, the number of lines in the first sheet will be different.
What I would like is a single cell at the top of the sheet that will give me total boxes going to each location that we ship to. So I want the sum of boxes for every lines that have NEWB as it destination as well as SANF. So each line calculation would be Value in K (number of full skid) * VLOOKUP of the part to get the box per skid (box per skid) + Value in L (number of loose boxes not making a full skid).
Is there a function that will do all of that for NEWB in one cell and SANF on another? The user enters the line as he goes so they are not all in groups. I might get 3 line of SANF then 2 of NEWB, then a couple of SANF and so forth.
Thanks,
Denis
I figured a way to do what I needed this weekend.
=SUMPRODUCT(K7:K52,IF(D7:D52="NEWB",1,0)*VLOOKUP(B7:B52,'Parts Data'!C3:H39,4,FALSE))
Basically I do a multiplication on every row no matter what with the sumproduct command. Number of skid (Col K) times the result of the IF statement. The IF statement will return the product of 1 times the vlookup value if the right location in Col D is what my formula is calculated for (NEWB) so basically the value of the vlookup is multiplied but number of skid for the sum. If the location is "SANF" then the product of the if command will be 0 times the value of vlookup which will give me 0, then time the number of skids, which will be 0 used for the sum.
I will copy and paste the same formula into a new cell and change "NEWB" to "SANF" in the formula for the calculation for the second location.
Hope this will help someone later.
Denis

Counting consecutive values based on multiple criteria

I want to count consecutive staff members (Col D) who service a specific vendor, based on if fees are over 20k (Col G)
I have this formula is Col G and drag it down:
{=SUMPRODUCT(($A$2:A2=A2)*($D$2:D2=D2)*($G$2:G2="Yes")*(ROW($G$2:G2)>MAX(IF(($A$2:A2=A2)*($D$2:D2=D2)*($G$2:G2="No"),ROW($G$2:G2)))))}
However, this causes an error count when a staff gets repeated on a same client after x years and doesn't reset the count.
Row 7 should show as 1, not 5.
If someone could help edit this formula to make it reset after another staff is fit between years?
#Edward's answer looks fine. Alternative (Excel 2019,O365) :
=IFS(G2="No","",OR(AND(G2="Yes",A1&D1<>A2&D2),AND(G2="Yes",SUMPRODUCT((($A$1:A1&$D$1:D1)=A2&D2)*1)=0)),1,AND(G2="Yes",SUMPRODUCT((($A$1:A1&$D$1:D1)=A2&D2)*1)>0),E1+1)
Output :
Sheet.v2
EDIT : For older versions of Excel :
=IF(G2="No","",IF(OR(AND(G2="Yes",A1&D1<>A2&D2),AND(G2="Yes",SUMPRODUCT((($A$1:A1&$D$1:D1)=A2&D2)*1)=0)),1,IF(AND(G2="Yes",SUMPRODUCT((($A$1:A1&$D$1:D1)=A2&D2)*1)>0),E1+1)))
As long as you have row 1 without data, like maybe headers. Then in E2 put
=sum(if((A2=A1)*(B2=B1)*(D2=D1)*(G2="Yes")*(DatedIF(C1,C2,"y")=1),E1+1,1))
and paste it all the way down.

Excel - Find corresponding values in single formula

I'm not sure how to phrase this hence the vague title.. sorry.
Here's my scenario.
Data
Table 1
Col A = Home Team
Col B = Away Team
Col C = Home Score
Col D = Away Score
What I would like to do is get an average of a teams last 3 scores in a single formula.
The issue is the team could appear in either column, home or away.
If the team is Col A - I need the value in Col C. If the team is in Col B - I need the value in Col D.
Any ideas are appreciated. I'm stumped.
Thanks
Just for interest, here's a shot at doing it with a single formula
=AVERAGE(INDEX(C1:D7,N(IF({1},LARGE(IF(A2:B7=F2,ROW(A2:B7)*3+COLUMN(A2:B7)),{1,2,3})/3)),
N(IF({1},MOD(LARGE(IF(A2:B7=F2,ROW(A2:B7)*3+COLUMN(A2:B7)),{1,2,3}),3)))))
Has to be entered as an array formula using CtrlShiftEnter and assumes data starts in column A
Edit
Not necessary to do division just for row so can simplify to
=AVERAGE(INDEX(C1:D7,N(IF({1},LARGE(IF(A2:B7=F2,ROW(A2:B7)),{1,2,3}))),
N(IF({1},MOD(LARGE(IF(A2:B7=F2,ROW(A2:B7)*3+COLUMN(A2:B7)),{1,2,3}),3)))))
This will be quite a ugly formula but it helps to get what you want, the average of the LAST three scores of a team:
In this example I have put the search value (Team2) in F9 (used in formulas)
Create a helper column and put this formula in it and drag it down (we need the rownumber of a hit in our future INDEX formula):
=IF(OR(A2=$F$9,B2=$F$9),ROW(A2),"")
Now we need to create a formula that will average the largest 3 numbers
=AVERAGE(INDEX(A1:D7,LARGE(E:E,1),MATCH($F$9,INDIRECT("A"&LARGE(E:E,1)&":B"&LARGE(E:E,1)),0)+2),INDEX(A1:D7,LARGE(E:E,2),MATCH($F$9,INDIRECT("A"&LARGE(E:E,2)&":B"&LARGE(E:E,2)),0)+2),INDEX(A1:D7,LARGE(E:E,3),MATCH($F$9,INDIRECT("A"&LARGE(E:E,3)&":B"&LARGE(E:E,3)),0)+2))
In this case the formula will return 4.33333
There is possibly a better way, however this one works :)
You could use COUNTIFS and SUMIFS to make a logical average calculation.
Formula in H4 below is:
=(SUMIFS(C:C,A:A,G4)+SUMIFS(D:D,B:B,G4))/(COUNTIFS(B:B,G4)+COUNTIFS(A:A,G4))
Another use of AVERAGEIFS with INDEX/AGGREGATE.
=AVERAGEIFS(INDEX(E:E, AGGREGATE(14, 7, ROW($2:$999)/((C$2:C$999=I5)+(D$2:D$999=I5)), 3)):F$999, INDEX(C:C, AGGREGATE(14, 7, ROW($2:$999)/((C$2:C$999=I5)+(D$2:D$999=I5)), 3)):D$999, I5)

How to count multiple text in multiple columns

I am Working off a large table in Excel and I want to sort the data into categories. What I’m trying to do is get Excel to count how many times a criteria in column C, D, & E occurs and returns the value. So look through C:C pick “Company”, then look through D:D for “Full Time – Temp” and then E:E for a location such as “Factory”. See link to sample table below.
Example:
G4 =COUNTIFS($C:$C,"company",$D:$D,"full time - temp",$E:$E,"home") and it returns 0
I4 =COUNTIFS($C:$C,"company bilingual",$D:$D,"bilingual - FT - perm") and it will return 3
My problem is column E
If I wanted to return in cell J4 how many “Company Bilingual” are “Bilingual - FT – Perm” and located in “Factory” I get 0.
I’ve tried using
J4 =COUNTIFS($C:$C,"company bilingual",$D:$D,"bilingual - FT – perm",$E:$E,"Factory") but it returns 0 and what I want it to return is 2, which I understand it is saying there is no Factory cell on its own, all the cells that have Factory have 3 items in them e.g Factory - Dallas. So I want to count all the factories in column E but not where the factory is actually located.
In summary what I want to do is find a function or array that will count one unique occurrence in column C, D, and E. If a cell in a column has more than one word I would like to be able to pick one word and ultimately still count all occurrences in the other columns and return a value.
In my research I have come across different suggestions but none that helps my problem.
I hope I've explained my problem, any assistance is greatly appreciated.
Screenshot of table
I suggest you make the criteria table and mention your criteria there as shown by me in the snapshot.Giving due credit to #Harsha Vardhan, his suggestion is correct approach as given in his comments. I have made a fully working example for clear understanding.
For partial string match I used a concatenated string in I2 ="*"&"Factory"&"*"
Criteria Table is in the Range G1:I4 and Results are in the Range J1:J4
Formula to be entered in J2 to J4 respectively are as per criteria mentioned in the table.
=COUNTIFS($C:$C,$G$2,$D:$D,$H$2,$E:$E,$I$2)
=COUNTIFS($C:$C,$G$3,$D:$D,$H$3)
=COUNTIFS($C:$C,$G$4,$D:$D,$H$4,$E:$E,$I$4)
Results are as per your requirement as shown in the snapshot.
EDIT DATE 23-06-2016
This has reference to OP's comments on 22nd and 23rd June 2016. There is no change in the formulas. It is required that conditions are put correctly in the criteria table. As per new criterion specified by OP, following snapshot shows that correct results are obtained. Further file count multiple text 23062016 has been uploaded for perusal.

VBA Code to sum values in one column based on the value in another column in excel

I am a VBA Newbie and a first timer on this forum - I have followed all the instructions on the "how to ask" page - I may have missed something please do advise
I am creating an EV report for project tracking based on the following column headers (showing only a few for brevity)
"TaskName" "Status" "BaselineStart" "BaselineFinish" "BaselineEffort"
need to sum up the values in the BaselineEffort column in 7 day increments after checking if the value in the BaselineFinish column is less than or equal to the 7th day value
I believe the answer lies in using arrays, but need handholding with that concept to understand how it works
Pivot and Excel formulas dont work for me because the table is dynamic while the report is static and I need to remove user intervention in creating the report
Thanks in advance
say that the criteria column starts in A1 and the colume to be summed starts in B1
do while not isempty(range("a1").offset(x,0))
if range("a1").offset(x,0) = SomeValue then
sum = sum + range("a1").offset(x,0)
end if
x = x + 1
loop
this code will run until it has looked at each item in column A, and add the value in column B to a sum I called "sum" if the value in column A equals "SomeValue." I doubt you can actually use the variable name "sum."
I hope that's useful.

Resources