I am trying to create a logic function in Excel where I can look at a range of data and if the argument contains text in each cell then the return should be "x", if contains text in 50% of the cells through 75% then "y", if 0% > 50% then "z".
This is my current function:
IF(A4:P4 = "*t*","Complete",IF(A4:P4 = "","Pending","Incomplete"))
Given your comment perhaps try this version:
=LOOKUP(COUNTA(A4:P4)/COLUMNS(A4:P4),{0,50,75,100}/100,{"incomplete","50 to 75","pending","complete"})
that will give incomplete up to 50%, "50 to 75" for 50% up to 75% and pending for 75% and above......except for 100% which wil be complete - adjust as required
Related
I have a dataset of co-ordinates, except the co-ordinate is split into two column X and Y.
I'm trying to find the percentage of co-ordinates in a single quadrant, and thought IF/AND statements would work i.e.
IF "numbers in X Column is between -5 and 0" AND "numbers in Y is between -5 and 0" then display total as Percentage of all data
IF "numbers in X Column is between 0 and 5" AND "numbers in Y is between 0 and 5" then display total as Percentage of all data
Etc..
I think that may be the easiest way but I'm stuck on three things;
How to do it for negative numbers
How to do "is greater than a number BUT less than a number" (rather
than just greater/less than), and
How to show results as a percentage (I only know how to return a
TRUE or FALSE) i.e.:
=IF(AND(A2:A100>5,B2:B100>5),TRUE, FALSE)
If you have the newest version of Excel you can use FILTER.
For example, if you are looking for the percent of coordinates in Q1 (0<=X<=5, 0<=Y<=5), you can use something like:
=ROWS(
FILTER($A$2:$B$100,
(($A$2:$A$100>=0)*($A$2:$A$100<=5)*($B$2:$B$100>=0)*($B$2:$B$100<=5))))/
ROWS($A$2:$A$100)
If not, then a simple way is to do what you were originally trying in a helper column, and divide the results by the total rows.
To answer your questions:
For negative numbers, e.g. Q3, just use negative numbers. Something like:
=IF(AND($A$2:$A$100>=-5, $A$2:$A$100<=0, $B$2:$B$100<=0, $B$2:$B$100>=-5),1, 0)
Logically, it is not really "greater than a number BUT less than a number", but "greater than a number AND less than a number". The example in question 1 shows that in action.
To get as a percent, you add up all the values, and divide by the total. In an IF statement you can return anything (format is =IF(test_is_true, value1, value2)), so in the above example, I elect to return 1 for whenever a row meets our criteria.
I'm trying to calculate the average % of a compounded increase.
For example, if $100 increases by 5% over three years, the average % increase over the whole period is 10.34%.
100.00 + 5% = 105.00, 105.00 + 5% = 110.25, 110.25 + 5% = 115.76, AVERAGE(105,110.25,115.76) = 110.34, (110.34 - 100) / 100 = 10.34%
I'm currently calculating this with lots of IF statements because duration, percent, and starting values are variable…
=((100*1.05+IF(3>=2,100*(5/100+1)^2)+IF(3>=3,100*(5/100+1)^3))/3-100)/100
my actual formula contains many, many more lines to catch durations up to 25 years which is why I'm looking to scale it down with some intelligent calculations
The results will be shared with other teams who don't use VBA, so needs to utilize in-built formulas.
Thank you,
Your basic formula would be:
=(AVERAGE(FV(0.05,{1,2,3},0,-100))-100)/100
This is an array formula and must be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode.
Now if one wants the inputs to be dynamic(pointed at input cells) then we need to change the formula a little:
=(AVERAGE(FV(B2,ROW($ZZ$1:INDEX($ZZ:$ZZ,B1)),0,B3))+B3)/(-B3)
Still an array formula
NOTE: If one has the dynamic array formula SEQUENCE it can be done without the need of CSE with:
=(AVERAGE(FV(B2,SEQUENCE(B1),0,B3))+B3)/(-B3)
The math solution is
=((1+R)^N-1)*(1+R)/(R*N)-1
where R is the rate and N is the number of periods.
I am trying to write a formula which states if a value is between X% and Y%, then the text in the cell will read Z.
An example would be if a percentage in cell C4 is between 1% and 39%, then cell D4 should read "Unsatisfactory". Similarly, between 40% and 49% would be "Of Concern", etc.,
The values are:
0% = N/A
1%-39% = Unsatisfactory
40%-49% = Of Concern
50%-64% = Satisfactory
65%-79% = Good
80%-89% = Very Good
90%-100% = Excellent
You will need to use AND together with IF. Something like below should work:
=IF(C4>=90%,"Excellent",
IF(AND(C4<90%,C4>=80%),"Very Good",
IF(AND(C4<80%,C4>=65%),"Good",
IF(AND(C4<65%,C4>=50%),"Satisfactory",
IF(AND(C4<50%,C4>=40%),"Of Concern",
IF(AND(C4<40%,C4>=1%),"Unsatisfactory",
"N/A"))))))
The formula goes in D4 as you've mentioned.
Edit1:
As mentioned by Andreas, if you really pay attention to the ordering, you can skip the < part. So above, can be simplified to:
=IF(C4>=90%,"Excellent",
IF(C4>=80%,"Very Good",
IF(C4>=65%,"Good",
IF(C4>=50%,"Satisfactory",
IF(C4>=40%,"Of Concern",
IF(C4>=1%,"Unsatisfactory",
"N/A"))))))
Another way of doing this is to use a lookup table. This can use an array constant inside Lookup like this:
=LOOKUP(A1,{0,1,40,50,65,80,90},{"N/A","Unsatisfactory","Of Concern","Satisfactory","Good","Very Good","Excellent"})
Or Vlookup with a table somwhere in your sheet like this
=VLOOKUP(A2,E$2:F$8,2,TRUE)
I have a matrix with multiple datasets in it using Lookup.
I would like to add some conditional formatting
Department A1 Complete A2 Complete A3 Complete
HR 90% 50% 2%
L&D 30% 100% 15%
I.T 65% 70% 12%
Ideally where anything over 80% is green, between 50% and 79% yellow and below 49% red.
This is one attempt I have made, the report runs but has no effect with the formatting
=switch(lookup(fields!Department.value,fields!Department.value,fields!A1.value,"Dateset1") > 80% , "Green","White")
How are you calculating the percentage, and how is it stored in your database, "80", "80%" or "0.8"?
Generally it's either 80 or 0.8 and the percentage is added with property formatting of the text box.
That being the case, you should remove the % from your code and see what happens.
I tend to use custom code.
Function SetColour(ByVal Value As Integer) As String
Dim Ret as string
Ret = "Blue"
Dim Val As Double
doubleVal = System.Convert.ToDouble(Variance)
if Value >= .86 then
Ret = "OliveDrab"
ElseIf Value <=.80 then
Ret = "IndianRed"
end if
End Function
The colour expression is called by Code.SetColour(me.value)
90% + Ist Division
71% - 90 % IInd Division
40% - 70% IIIrd Division
< 40% Fail
Nested if excel formula for excel for above condition .
I applied below formula but seems to be not correct:
=IF(AND(i4>=40%,i4<=70%),"3rd",IF(AND(i4>=71%,i4<=90%),"2nd",IF(i4>90%,"ist"),IF(i4<40%,"fail")))
Start at the top:
=IF(I4>.9,"1st",IF(I4>=.71,"2nd",IF(I4>=.4,"3rd","FAIL")))
This way one only needs to step through the lowest threshold. Once one of the Ifs returns true it will not do the others.