24/06/2025
شرح مبسط لدالة IF الشرطية
تعريف الدالة IF
دالة IF بنستخدمها لما نحب نختبر شرط معين ونشوف لو اتحقق نرجع قيمة ولو ما اتحققش نرجع قيمة تانية
شكل الدالة
=IF(الشرط, القيمة لو صح, القيمة لو غلط)
المكونات الأساسية للدالة
الشرط: زي مثلا A1>50
القيمة لو الشرط اتحقق: زي كلمة "ناجح"
القيمة لو الشرط ما اتحققش: زي كلمة "راسب"
أمثلة عملية
لو عندك درجة في الخلية A1 وعايز تقول "ناجح" لو الدرجة أكبر من أو تساوي 50، أو "راسب" لو أقل
=IF(A1>=50,"ناجح","راسب")
ولو عايز تطلع لقب حسب الجنس في الخلية B1
=IF(B1="ذكر","Mr","Ms")
IF المتداخلة
لو عايز تقيم حسب الدرجات
لو أكتر من أو يساوي 85 يبقى "امتياز"
لو أكتر من أو يساوي 65 يبقى "جيد"
لو أكتر من أو يساوي 50 يبقى "مقبول"
أقل من كده يبقى "راسب"
=IF(A1>=85,"امتياز",IF(A1>=65,"جيد",IF(A1>=50,"مقبول","راسب")))
أخطاء هتقابلك
نسيان الأقواس
نسيان تحط النصوص بين علامات اقتباس
اللغة بتأثر على الفاصلة (ممكن تكون , أو ;)
ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ
Definition of the IF Function
We use the IF function when we want to test a specific condition and return one value if it’s true and another value if it’s false.
Syntax of the Function
=IF(condition, value_if_true, value_if_false)
Main Components of the Function
Condition: for example, A1 > 50
Value if the condition is true: like the word "Pass"
Value if the condition is false: like the word "Fail"
Practical Examples
If you have a score in cell A1 and want to display "Pass" if the score is 50 or more, and "Fail" if it’s less
=IF(A1>=50,"Pass","Fail")
If you want to display a title based on gender in cell B1
=IF(B1="Male","Mr","Ms")
Nested IFs
If you want to evaluate based on scores:
85 or more → "Excellent"
65 or more → "Good"
50 or more → "Pass"
Less than that → "Fail"
=IF(A1>=85,"Excellent",IF(A1>=65,"Good",IF(A1>=50,"Pass","Fail")))
Common Mistakes
Forgetting parentheses
Forgetting to put text between quotation marks
The function separator may vary depending on Excel language settings (can be a comma , or a semicolon ;)