I’m a designer. I have a list of tasks, with hours, and I’ve split them into milestones. I want to count the number of hours for each milestone.
Here’s a picture:
In other words: I want to look at the value in the M column, if it’s 1, I want to get the cell across it, then repeat down the rows, and sum the whole lot.
See if you can figure that one out with the least cell wastage! :) (This is Numbers for Mac, so no macros or vbscript or what-have-you.)
In Excel the SUMIF formula can be used.
Assumption: In picture above, the 'Hours' label is in cell A1
The formula for 'Milestone 1' in cell E2 would be:
=SUMIF($C2:$C11,RIGHT(E1,1),$A2:$A11)
The syntax of the formula is:
=SUMIF(range, criteria, sum range)
The criteria is determined by using the last character in the 'Milestone' heading.
Related
I need to sum Amount for all the dates if there is value in India row:
I tried implementing with COUNTIF function but its not solving my problem, any suggestion welcome, I am pretty new to Excel formulas.
Try this.
Let's assume the top left cell on your image is cell "A1". Go to cell "C6" and paste the following formula:
=IF(C2>0,C2*(SUM(C4:C5)),"")
Now fill/copy that formula across to cell "G6". Then go to cell "H6" and paste the following formula:
=SUM(C6:G6)
Hope this helps.
What about this:
=SUMPRODUCT(C2:E2+C3:E3,C4:E4+C5:E5)
It's basically adding the two first rows, adding third and fourth rows, and taking the sumproduct. Obviously, you need to make sure not have a number in both rows one and two, and in both rows three and four.
My SUMIFS formula criteria is based on a cell (say A1) that is data validated by list and changed via selection by user. If cell has data inside text or number by selection from drop down list, SUMIFS formula is considering that data as criteria to calculate the related sum. If criteria cell is left blank, I want formula to sum everything without any condition. My problem here; in criteria field of SUMIFS formula, I typed if condition like; SUMIFS(sum-range,criteria_range,IF(A1<>"",A1,"*")) but in this case excel considers only text values and do not include cells containing number. Briefly, if nothing selected in A1, I want SUMIFS formula to sum everything without any condition, numbers, texts and even blank cells. How can we proceed to do that?
EDIT:
Here an example for data and formula, what is expected is actually to disable criteria if one of selection is blank on left. Harun's suggestion works but if there is blank cell in criteria range, then in this case it won't consider those values in sum. For instance, if we select from left Phone/smart/touch, then how can we get "2" as output no matter what is in cri_range4 cells? Thanks
Example:
How about this solution? It basically ignores a missing entry in column C and evaluates only the other two. (Your example formula has a fourth criterium that isn't apparent in your list but the method can be extended for as many criteria as you might have.
=SUMPRODUCT((IF(LEN(C2),(INDEX(Lists,,1)=C2),TRUE))*(IF(LEN(C3),(INDEX(Lists,,2)=C3),TRUE))*(IF(LEN(C4),(INDEX(Lists,,3)=C4),TRUE))*SumRange)
For better readability I created a named range Lists which comprises your sample range E2:H10 while I named I2:I10 as SumRange'. INDEX(Lists,,1}` refers to the first column of the range. It's important that SumRange and Lists have the same number of rows.
If A1 is blank then just use not equal operator to sum all cells that are not blank. Try below.
=SUMIFS(D1:D5,C1:C5,IF(A1<>"",A1,"<>"))
Edit: can you check below formula in D3 cell then drag down.
=IF(C2="",SUM($I$2:$I$10),SUMPRODUCT(($E$2:$H$10=C2)*($I$2:$I$10)))
Not really an Excel user, but what seemed simple has turned out to be very difficult for me. I am in trouble as I can't come up with a nice and clean (or any) way to get it working.
What I have here:
I need to create a new columnn that would tell the amount of employees in each occupation while ignoring the duplicates (highlighted).
The amount of names formula is working, so maybe this can be used ? Or maybe it's just in the way and should be cleared.
It's just:
=COUNTIFS(A:A;A2)
Tried searching for quite a while did not find anything suitable. Any help or advice would be much appreciated. I hope I explained it in clear manner.
Thank you
Without helper columns:
Two options, D2:
{=SUM(--(FREQUENCY(IF($B$2:$B$9=C2,MATCH($A$2:$A$9,$A$2:$A$9,0)),ROW($A$2:$A$9)-ROW($D$1)+1)>0))}
Or put in E2:
{=SUMPRODUCT((($B$2:$B$9=C2))/COUNTIFS($B$2:$B$9,$B$2:$B$9&"",$A$2:$A$9,$A$2:$A$9&""))}
Notice both are array formulas and should be entered through CtrlShiftEnter
SUMPRODUCT 'Deals' in Arrays 3
You might have employees with the same name (David, Michael) in different occupations (Tech & Worker, Tech & Economy). To distinguish those from each other, in B2 you can use:
=SUMPRODUCT((A$2:A$21=A2)*(C$2:C$21=C2))
In D2 you can use:
=SUMPRODUCT((1/B$2:B$21)*(C$2:C$21=C2))
Distinct Employees Occupation Count
with a helper column
Unique and Distinct values are tricky. Using a helper column is beneficial for identifying either one of these when coupled with an expanding range:
=SUMPRODUCT((A2=$A$1:$A1)*(C2=$C$1:$C1))
Relative Rows: ^ ^
Paste to cell E2.
Copy Drag the formula down from the where pasted.
The relative row numbers identified above well increase as the formula is copy dragged down. This creates a larger and larger range for comparison. An expanding range.
In this case the range that is expanding is the range of already checked values. Many times the result range is expanded and tested against to eliminate posting duplicates of already posted results in subsequent rows of the results list.
The helper column's value is how many times the name and occupation pair has previously appeared. Zero previous appearances tells us this is the first occurance. We will only count the zeros (first occurance) in the main formula.
The main formula for counting distinct employees in each occupation:
=COUNTIFS( $C$2:$C$9, C2, $E$2:$E$9, 0)
Paste to cell D2.
Copy Drag the formula down from the where pasted.
Here we count all the rows for this row's occupation where the occupation matches the range of listed occupations and for that particular row in the list of occupations, the helper column row value is zero.
Add a final column which is the concatenation of the prior 3 columns then use
=SUMPRODUCT(1/COUNTIF(D2:D9,D2:D9))
There is a good explanation of this formula here. Basically, values that appear once will count as 1. Values that appear more than once will appear as fractions of their total occurrence count and be summed to 1.
If you convert your data to an Excel table by selecting a populated cell in the range and pressing Ctrl+T, then formulas will auto-populate down last column. You can then reference the table columns in the formula and you won't need to amend the formula as you add rows.
I am supposed to sum up the total highlighted numbers and add the sum in the red marked cell beside the average number. I am using a basic SUM formula to add the cells. I have a couple thousand lines to do this with and I have to manually change the SUM formula to include the right ranges (as some have 4 numbers to add up, some have 3 and others have 2). Is there a way to write the formula so it SUMS all the numbers up until the Average line above it? So I can use the same formula throughout my sheet and not have to change it for every line?
No need for Array formulas.
I will assume you are starting in H2. As per your photo in the discussion
=IF(E2 = "Average",SUMIF($E$1:E1,"<>Average",$G$1:G1)-SUM($H$1:H1),"")
And copy down.
You could use a variable range within a SUM function, using INDEX and MATCH to find the previous instance of Average.
Something like this - an array formula, so enter with Ctrl+Shift+Enter:
=SUM(B3:INDEX(B$1:B3,IFERROR(MATCH(2,1/(A$1:A3="Average")),0)+1))
I have an excel spreadsheet that lists a bunch of names and we are keeping track of how many times a certain occurrence happens. What I'm needing to do is find a way to calculate which name has the highest value of occurrences, and then display that name in another cell. What I'd also like to do, is if there is a tie, I'd like to display all of the names of the people who are in the tie for 1st. Any assistance is appreciated.
Thanks in advance.
You can use the Advanced Filter feature to do this:
(Screen shot from Excel 2010)
Formula in cell B2: =COUNTIFS(A:A,A2) (copy down as raf as required)
Formula in cell D2: =MAX(B:B)
Click OK and highest count names will be listed in column F (t and y in this example)