Can't find the right formula in Excel - excel

I have 3 conditions based on this table: https://i.stack.imgur.com/GAeT0.png
Conditions are:
In column "Stadiu" (starting from D5) should type:
RIDICATA if the number from Populatie is > 1000 and the column Eveniment has Mondiala in it
MEDIE if the number from Populatie is > 500 or <= 1000 and the column Eveniment has Mondiala
MEDIE if the number from Populatie is > 500 and the column Eveniment has Internationala
SLABA = rest
I tried this formula:
=IF(AND(C5>1000;FIND("Mondiala";A5));"ridicata";IF(AND(C5>500;C5<=1000;FIND("Mondiala";A5));"medie";IF(AND(C5>500;FIND("Internationala";A5));"medie";IF(AND(C5<500);"slaba"))))
but it doesn't work.
I am new to Excel, so I hope you guys can help me what I am doing wrong. Thanks!

When evaluating the formula, anywhere that the FIND function doesn't find the string you're searching for, it returns a #VALUE error instead of 0 or FALSE. That's causing the whole formula to fail in those circumstances, so you need to handle those cases with IFERROR.
In addition, your nesting wasn't quite correct. You did not have an ELSE result for cases where all three tests failed. The following formula should return the expected results based on your criteria provided:
=IF(AND(C5>1000;IFERROR(FIND("Mondiala";A5);0));"Ridicata";IF(OR(AND(C5>500;C5<=1000;IFERROR(FIND("Mondiala";A5);0));AND(C5>500;IFERROR(FIND("Internationala";A5);0)));"Medie";"Slaba"))
Might be a little easier to relate it to your test criteria by spreading it out into sections:
=IF(
AND(
C5>1000;
IFERROR(FIND("Mondiala";A5);0)
);
"Ridicata";
IF(
OR(
AND(
C5>500;
C5<=1000;
IFERROR(FIND("Mondiala";A5);0)
);
AND(
C5>500;
IFERROR(FIND("Internationala";A5);0)
)
);
"Medie";
"Slaba"
)
)

Related

How to formulate index match with if statements?

I have a problem in my formula regarding on "EQUAL/MATCH" value using if and index match. I have two sheets, "Targets(database)", and "STUDENTS(input)". Example from sheet "STUDENTS" if I input 80% in Performance1, it will look to sheet Target(table) the Performance1 having equal to 80% and multiply it to the multiplier 10%. See table and sample below
TARGET(table range)
STUDENTS(correct answer)
FORMULA
=IF(
C7<Targets!$C7,
Targets!$C$5*$B7,
IFERROR(
INDEX(
Targets!$C$5:$H$5,1,
MATCH(STUDENTS!C7,Targets!$C7:$H7,0)
)*$B7,
INDEX(
Targets!$C$5:$H$5,1,
MATCH(STUDENTS!C7,Targets!$C7:$H7,1)
)*$B7
) )
Now the problem here is that when I input an "EQUAL/MATCH" value, example Performance1 80% the answer must be 3%(10%*30%) but it gives me 2.70%(9%*30%). See below incorrect answer
STUDENTS(incorrect answer)
What can I try next?

Excel - MAX and MIN value by month for a certain item

Can someone help me out with a formula?
I have a large database and I`m trying to figure out, how to get the MAX amount used in January 2017 for a product X.
I have found the averages using - AVERAGEIFS(Avg.de.time!E3:E80231;Avg.de.time!A3:A80231;C2;Avg.de.time!C3:C80231;">="&H7;Avg.de.time!C3:C80231;"<="&EOMONTH(H7;0))
Column A - Item no.
Column B - Supplier name
Column C - Order date
Column D - Receive date
Column E - Delivery time (D-C)
I`ve spent too many hours on trying to figure this out.
So I m asking for Help :)
Using array formulae you can rewrite your AVERAGEIFS statement using a conditional array expression as follows:
=AVERAGE(
IF(
(
(Avg.de.time!A3:A80231 = C2) *
(Avg.de.time!C3:C80231 >= H7) *
(Avg.de.time!C3:C80231 <= EOMONTH(H7,0))
) > 0,
Avg.de.time!E3:E80231
)
)
I've just formatted the code to make it easier to see where each of the criteria, criteria_ranges and value_range appear however this will obviously be one long line in your cell.
It's now very simple to swap out AVERAGE at the start with MAX, MIN or another aggregate function with the rest of the formula remaining identical.
=MAX(
IF(
(
(Avg.de.time!A3:A80231 = C2) *
(Avg.de.time!C3:C80231 >= H7) *
(Avg.de.time!C3:C80231 <= EOMONTH(H7,0))
) > 0,
Avg.de.time!E3:E80231
)
)
As this is an array formula, you will need to type it into your Excel cell and hit Ctrl-Enter to make it an array formula. You can check this worked as curly braces {} will appear around the formula.

Average not working with indirect formula and blank values

I have this formula:
=IFERROR(
(
(
IFERROR(INDIRECT($A6&"!$E$15");"")
+IFERROR(INDIRECT($A6&"!$E$29");"")
+IFERROR(INDIRECT($A6&"!$E$43");"")
+IFERROR(INDIRECT($A6&"!$E$57");"")
+IFERROR(INDIRECT($A6&"!$E$71");"")
+IFERROR(INDIRECT($A6&"!$E$84");"")
)
/6);"")
When any of these IDIRECTS return a blank value, I get an #VALUE! error (without the first IFERROR). Each individual line works just fine, and when putting them in cells individually, I can average them fine. If I remove the /6 part of this formula however, and wrap the lines with an AVERAGE-formula, I get the #VALUE! error also.
How can I proceed?
EDIT, SOLUTION FOUND (Thanks Mrig):
=IFERROR(
(
(
IF(ISNUMBER(INDIRECT($A7&"!$E$15"));INDIRECT($A7&"!$E$15");0)
+IF(ISNUMBER(INDIRECT($A7&"!$E$29"));INDIRECT($A7&"!$E$29");0)
+IF(ISNUMBER(INDIRECT($A7&"!$E$43"));INDIRECT($A7&"!$E$43");0)
+IF(ISNUMBER(INDIRECT($A7&"!$E$57"));INDIRECT($A7&"!$E$57");0)
+IF(ISNUMBER(INDIRECT($A7&"!$E$71"));INDIRECT($A7&"!$E$71");0)
+IF(ISNUMBER(INDIRECT($A7&"!$E$84"));INDIRECT($A7&"!$E$84");0)
)/
(
COUNTIF(INDIRECT($A7&"!$E$15");">=0")
+COUNTIF(INDIRECT($A7&"!$E$29");">=0")
+COUNTIF(INDIRECT($A7&"!$E$43");">=0")
+COUNTIF(INDIRECT($A7&"!$E$57");">=0")
+COUNTIF(INDIRECT($A7&"!$E$71");">=0")
+COUNTIF(INDIRECT($A7&"!$E$82");">=0")
)
);"")
The COUNTIF's bascially replaces the number "6" in the original code, and checks which of the INSNUMER's (instead of IFERROR's) that isn't blanks, so anything that's 0% or higher (actual value) will be counted, to get to the true average.
Using the suggestions above in the comments, you can use IF(ISNUMBER()) instead of IFERROR()
=IFERROR(
(
(
IF(ISNUMBER(INDIRECT($A6&"!$E$15"));INDIRECT($A6&"!$E$15");0)
+IF(ISNUMBER(INDIRECT($A6&"!$E$29"));INDIRECT($A6&"!$E$29");0)
+IF(ISNUMBER(INDIRECT($A6&"!$E$43"));INDIRECT($A6&"!$E$43");0)
+IF(ISNUMBER(INDIRECT($A6&"!$E$57"));INDIRECT($A6&"!$E$57");0)
+IF(ISNUMBER(INDIRECT($A6&"!$E$71"));INDIRECT($A6&"!$E$71");0)
+IF(ISNUMBER(INDIRECT($A6&"!$E$84"));INDIRECT($A6&"!$E$84");0)
)/6);"")
I started off thinking that your 'stagger' was 14 rows so I went with this array formula:
=AVERAGE(IF(MOD(ROW(E15:E84), 14)=1, IF(ISNUMBER(INDIRECT($A6&"!E15:E84")), INDIRECT($A6&"!E15:E84"))))
... but your 'stagger' is not a consistent 14 rows; the last gap is 13 rows so I modified it to this:
=AVERAGE(IF(ROW(15:84)={15,29,43,57,71,84}, IF(ISNUMBER(INDIRECT($A6&"!E15:E84")), INDIRECT($A6&"!E15:E84"))))
That produces a true average without zero substitution on blank cells while discarding text values.

Nested IF,VLOOKUP Formula

I am trying to write a formula to replace my results with a specific text if the returned results are either N/A, 0 or blank.
However, I can't seem to get it quite right. This is what I have so far.
IF(
LEN(
VLOOKUP($E3,'[Global Spend Categories SQL.xlsx]SQL Results USE'!$B$3:$I$4609,6,0)
)=0,"TO BE CATEGORISED",IF(LEN(
VLOOKUP($E3,'[Global Spend Categories SQL.xlsx]SQL Results USE'!$B$3:$I$4609,6,0)
)="","TO BE CATEGORISED",VLOOKUP($E3,'[Global Spend Categories SQL.xlsx]SQL Results USE'!$B$3:$I$4609,6,0)
)
)
My formula above is replacing the 0 and blank results with "TO BE CATEGORISED", however when I try to add in for N/A's it doesn't work.
Can anyone help with a solution to where I am going wrong?

IF(AND statement with multiple criterias

I am trying to write a formula to include multiple criteria and can't seem to get it right.
The formula works as is however I need to include "SHOT10","SHOT20", "SH15" and "SH20"
=IF(AND(C5194="SHOT15",H5194="",I5194=""),E5194,"")
Can someone assist me with modifying the above formula?
The AND(C5194="SHOT15",H5194="",I5194="") is equivalent to saying:
C5194="SHOT15" And H5194="" And 15194=""
So what you have in VBA code is:
If C5194="SHOT15" And H5194="" And 15194="" Then
ActiveCell = E5194
Else
ActiveCell = ""
End
You can use AND( and OR( to specify different parameters.
For example, If I want to pickup 3 different values in 'A1', but make sure that 'B1' and 'C1' are blank, I can use:
=IF(AND(OR(A1="A",A1="B",A1="C"),B1="",C1=""),"True","False")
So in your case specifically:
The issue now is that I now need to also consider SHOT10, SHOT20, SH15 and SH20 as well. Meaning that if either SHOT15, SHOT10, SHOT20, SH15 or SH20 appears in C5194 and H5194 is blank and I5194 is also blank then return the value of E5194 else return blank. The key is that all the conditions must be met for the value of E5194 be returned
Your formula becomes:
=IF(AND(OR(C5194="SHOT15",C5194="SHOT10",C5194="SHOT20",C5194="SH15",C5194="SH20"),H5194="",I5194=""),E5194,"")
Edit: Shorten Using an array constant per barry houdini:
=IF(AND(OR(C5194={"SHOT15","SHOT10","SHOT20","SH15","SH20"}),H5194="",I5194=""),E5194,"")
=IF(
AND(
OR( C5194="SHOT10", C5194="SHOT15", C5194="SHOT20", C5194="SH15", C5194="SH20" ),
H5194="",
I5194=""
),
E5194,
""
)

Resources