How can I apply the if condition on a range of cells?
Let us say I have scores of different subject for a student. I want to return a value "Fail" even if any one of the scores is less than 50. Can this be done with the if conditions on Excel?
Yes
=IF(COUNTIF(A:A,"<50")>0,"Fail","Pass")
If it finds any value in Column A that is less than 50 it will report Fail. If not it will report "Pass".
Related
I have a spreadsheet with two tabs. The first one contains Vehicle Types and a numeric score value.
Second Tab has like a variety of these vehicle types and what should be the total score. Depending on the vehicle types present in the respective neighbour cell.
See images below for illustration.
Is there a way via formula to get the total, in Column B in sheet 2, of the corresponding numeric values of column a from sheet 1?
For example, as per the illustration B2 in sheet would total 3; whereby in sheet 1 bus has a score of 1 and car 2.
Update:
As per the answer below, I have used the formula;
=SUMPRODUCT(ISNUMBER(FIND(" "&sheet1!A$2:A$4&" "," "&SUBSTITUTE(A4,CHAR(10)," ")&" "))*sheet1!B$2:B$4)
However, I am unfortunately getting zero as the value. Changing the line breaks in column A in sheet2 I am duly able to get the total. Is there a way to do it so irrespective of how the list is presented in the column the total will work?
I think you are after something like this:
Formula in E2:
=SUMPRODUCT(VLOOKUP(FILTERXML("<t><s>"&SUBSTITUTE(D2,CHAR(10),"</s><s>")&"</s></t>","//s"),A$2:B$4,2,FALSE))
If one has O365 you could just use SUM instead since it would auto-CSE the formula.
If you don't have Excel 2013 or later, you could try the following as another option (shorter but not my favourite):
=SUMPRODUCT(ISNUMBER(FIND(" "&A$2:A$4&" "," "&SUBSTITUTE(D2,CHAR(10)," ")&" "))*B$2:B$4)
i need a formula to distribute values across a range while accounting for the max value possible
conditions to check:
IF the cell value is less than max then take cell value, ELSE
subtract cell value from max AND
check conditions if there is a remainder in the subtraction and add to the next row; otherwise place 0
sample data & ideal outcome breakdown is the ideal outcome
i know VBA can solve this but i'd rather not if possible. thanks for any help.
Also, not against using a helper column :)
Updated
when the values are the same on the series, it replaces with a 0 any idea it can dynamically reset based on the length of the series
put this in B3 and copy down:
=IF(A3<>A2,MIN(A3,$B$1),MIN(A3-SUM(INDEX(B:B,MATCH(A3,A:A,0)):B2),$B$1))
I would like to find the row at which running summed value has reached a specified amount and several criteria have been met (similar to sumifs).
I can't just add a cumulative row, as suggested here:
Count rows until the sum value of the rows is greater than a value
....because I have other criteria to meet in the data, and therefore can't have a running total.
In the following dummy example, I'd like to find the date at which the "Design" project has spent or exceeded $30,000
A late answer, but one that doesn't use a Helper Column.
By using Matrix Multiplication (MMULT) on a TRANSPOSEd array of whether the Row is larger than itself and the list itself, we can produce an array of the Running Total.
MMULT(--(TRANSPOSE(ROW(D2:D21))<=ROW(D2:D21)), D2:D21)
If we shrink this to just the first 3 rows, to demonstrate, then you are making this calculation:
[[--(2<=2)][--(3<=2)][--(4<=2] [[10,000]
[--(2<=3)][--(3<=3)][--(4<=3] ∙ [ 8,000]
[--(2<=4)][--(3<=4)][--(4<=4]] [ 6,000]]
Which gives us this:
[[1][0][0] [[10,000] [[10,000]
[1][1][0] ∙ [ 8,000] = [18,000]
[1][1][1]] [ 6,000]] [24,000]]
We can then compare that against the target value as a condition and divide by the result to eliminate values with #DIV0! errors, and use AGGREGATE to get the smallest non-error value
=AGGREGATE(15, 6, Row(D2:D21) / (MMULT(--(TRANSPOSE(ROW(D2:D21))<=ROW(D2:D21)), D2:D21)<30000), 1)
This will give us the first row where the Running Total is >= $30,000
make a cumulative row, only adding up if column B equals 'Design'
If you want to be able to do a vlookup, you should make an extra column that checks if amount exceeded 30k, and then output anything that will be your key for the vlookup.
Ok, for anyone who is interested, here is what I ended up doing. I created a separate table that had all of my possible weeks (10/17, 10/24, 10/31, etc.) in one column, and corresponding sequential numbers in the next column. I ended up with 54 in my actual project.
Then, I ended up having to insert one column into my dataset for the purposes of looking up that "Week No", for each "Week" in all rows. Then on my other sheet where I was solving, I had a cell be my decision variable for the week #. I had another be my target $. I created a formula that took my target amount minus the SUMIFS for all of my criteria (Project, Name, etc.) with the last criteria being that the week number had to be "<=" & (decision cell). I then used Solver to minimize the output by changing the target week with constraints that the target week had to be integer, >=1, <=54, and that the output had to be >=0. That got me to the week prior to where the funding went negative. I then had a cell lookup that week number +1 on my weeks table to find the week at which my target amount would be met.
Sorry, had to explain it that way, vs. the actual formula, as my actual formula has a lot of SUMIFS criteria and cell references that wouldn't make any sense here.
I am working on an attendance sheet in Excel 2010. I need to count total no of attendance of a student in terms of his/her category.
For example, I have 4 student categories:
CAT1
CAT2
CAT3
CAT4
Please note that the sheet is not shorted on category, so their occurrence is random. Now I have 30-31 cells adjacent to these categories for attendance. These cells have values either a "P" or an "A".
Now I have to count total no of attendance in each category after the end of the month.
Please help !
EDIT: Kindly see the image:
EDIT: #Rosenheimer, As you can see in the image I uploaded, my cell range for attendance is not contiguous. Is there any way to refer to multiple cell ranges in SUMPRODUCT? Right now, I am using 1 SUMPRODUCT for each range and adding them which is very lengthy:
=SUMPRODUCT((Sheet1!E6:Sheet1!AI14=Sheet1!A65)(Sheet1!D6:Sheet1!D14=Sheet1!A69)(Sheet1!C6:Sheet1!C14=Sheet1!A67))+SUMPRODUCT((Sheet1!E18:Sheet1!AI26=Sheet1!A65)(Sheet1!D18:Sheet1!D26=Sheet1!A69)(Sheet1!C18:Sheet1!C26=Sheet1!A67))+SUMPRODUCT((Sheet1!E30:Sheet1!AI37=Sheet1!A65)(Sheet1!D30:Sheet1!D37=Sheet1!A69)(Sheet1!C30:Sheet1!C37=Sheet1!A67))+SUMPRODUCT((Sheet1!E41:Sheet1!AI45=Sheet1!A65)(Sheet1!D41:Sheet1!D45=Sheet1!A69)(Sheet1!C41:Sheet1!C45=Sheet1!A67))+SUMPRODUCT((Sheet1!E49:Sheet1!AI62=Sheet1!A65)(Sheet1!D49:Sheet1!D62=Sheet1!A69)(Sheet1!C49:Sheet1!C62=Sheet1!A67))
Thank you !
You could do it with a conditional sum:
Please note that it is called SUMPRODUCT in English Excel applications (function names are translated for Microsoft Excel).
The evaluation A$2:A$7=D2 is either true or false, which will be interpreted as 0 (false) or 1 (true) for the multiplication with the literal 1.
Now you can add further statements to the evaluation, for example you might extend it to (A$2:A$7=D2)*(C$2:C$7="P")*(F$2:F$7>=DATE(2015,07,01))*(F$2:F$7<DATE(2015,08,01)) to only count students that are marked with P in July.
Edit:
Since you're effectively using a matrix and not just a list, you need to use a sligthly different variation, but it can still be done with SUMPRODUCT, look at this example:
If you want to count the occurrence of different cells that meet a specific criteria then use the function "COUNTIF". But if you want to count cells that fulfill multiple criteria then use the function "COUNTIFS"
Forgive me as I'm a bit of a novice with Excel and have no idea if this is possible or not. Looking for a formula to return one of four values, based on two criteria. One is a Drop-down list with either "Sun-Sat" or "Thur-Wed" options, and the other is a date value. If the date entered falls on a Monday or Tuesday it should return one value, and if the date entered falls on a Wednesday/Thursday/Friday it should return another.
A B
Sun-Sat Thurs-Wed
1 Monday/Tuesday 28/06/2015 25/06/2015
2 Wednesday/Thursday/Friday 5/07/2015 2/07/2015
Drop down box is cell B6 and Date is cell A6
I hope that is enough detail, any help is greatly appreciated!
Say you have these on the "Match" sheet:
A B C
1 Sun-Sat Thurs-Wed
2 Monday/Tuesday 28/06/2015 25/06/2015
3 Wednesday/Thursday/Friday 5/07/2015 2/07/2015
And say you keep the first criterion(Match!$A) in A2 and the second (Match!$1) in B2.
The formula you'll need is:
=INDEX(Match!$1:$1048576;MATCH($A2;Match!$A:$A;0);MATCH($B2;Match!$1:$1;0))
The MATCH() formulae provides the indices that the INDEX() formula uses to identify the output cell.
As pnuts have highlighted I missed that it was one date and one validation.
=INDEX(Match!$1:$1048576;MATCH(IF(OR(WEEKDAY($A6)=2;WEEKDAY($A6)=3);"Monday/Tuesday";"Wednesday/Thursday/Friday");Match!$A:$A;0);MATCH($B6;Match!$1:$1;0))
is an augmented version for when the A column contains dates. Note: I treated the two sets as alternatives, the weekends will be wrongly classified if existent.
Edit not from answerer - layout might be closer to OP's, with formula adjusted to suit (also shows results from various inputs):