Excel IF Function Explained with Examples (2025 Complete Guide)

Excel IF Function Explained with Examples (2025 Complete Guide)

Introduction

Microsoft Excel में IF function एक logical powerhouse है। यह आपको automatic निर्णय लेने में मदद करता है—यदि कोई condition TRUE है तो एक value लौटाता है, और यदि वह FALSE है तो दूसरा value लौटाता है।

इसे Excel के built-in decision-maker के रूप में सोचें।

उदाहरण: "यदि marks 40 से अधिक हैं, तो Pass दिखाएँ; अन्यथा, Fail दिखाएँ।"

चाहे आप छात्रों की grading, business report या financial models पर काम कर रहे हों, IF function Excel के सबसे आवश्यक tools में से एक है।


IF Function का Syntax

=IF(logical_test, value_if_true, value_if_false)

Argument Description
logical_test वह condition जिसका आप evaluation करना चाहते हैं। TRUE या FALSE लौटाना होगा।
value_if_true यदि test TRUE है तो Excel result लौटाता है।
value_if_false यदि test FALSE है तो Excel result लौटाता है।

Example 1 — Simple IF Formula (Pass/Fail)

Student Marks Formula Result
Asha 85 =IF(B2>=40,"Pass","Fail") Pass
Raj 32 =IF(B3>=40,"Pass","Fail") Fail

Explanation:

यदि अंक ≥ 40 → Excel “Pass” दिखाता है; अन्यथा “Fail”।


Logical Operators in IF

Operator Meaning Example Result
= Equal to =IF(A1=10,"Yes","No") Yes
Greater than =IF(A1>10,"Yes","No") Yes
Less than =IF(A1<10,"Yes","No") Yes
>= Greater or equal =IF(A1>=10,"Yes","No") Yes
<= Less or equal =IF(A1<=10,"Yes","No") Yes
<>  Not equal =IF(A1<>10,"Yes","No") Yes

Example 2 — IF for Commission Eligibility

Salesperson Sales (₹) Formula Result
Raj 65000 =IF(B2>50000,"Eligible","Not Eligible") Eligible
Meena 48000 =IF(B2>50000,"Eligible","Not Eligible") Not Eligible

Explanation:
यदि sales ₹50,000 से अधिक है → “Eligible”।


Example 3 — IF Returning Numbers

=IF(A2>=60,1,0)
यदि marks ≥ 60 → 1; else 0.
Scoring और binary analysis के लिए उपयोगी।


Example 4 — Nested IF (Multiple Conditions)

Marks Formula Grade
90 =IF(A2>=90,"A",IF(A2>=80,"B",IF(A2>=70,"C",IF(A2>=60,"D","F")))) A

Logic:

  • ≥90 → A
  • ≥80 → B
  • ≥70 → C
  • ≥60 → D
  • Else → F

Example 5 — IF with AND

Multiple TRUE conditions की जाँच करें.

Math English Formula Result
45 50 =IF(AND(A2>=40,B2>=40),"Pass","Fail") Pass
38 42 =IF(AND(A3>=40,B3>=40),"Pass","Fail") Fail

Example 6 — IF with OR

Math English Formula Result
45 35 =IF(OR(A2>=40,B2>=40),"Pass","Fail") Pass
30 25 =IF(OR(A3>=40,B3>=40),"Pass","Fail") Fail

यदि कम से कम एक condition TRUE है → “Pass”।


Example 7 — IF with Dates

=IF(A2<TODAY(),"Past Due","Upcoming")

Due Date Result
10/15/2025 Past Due
10/22/2025 Upcoming

Example 8 — IF with ISBLANK

=IF(ISBLANK(A2),"Missing","Available")

A2 Result
(empty) Missing
Apple Available

Example 9 — IF for Bonus Calculation

Employee Performance (%) Formula Bonus
Raj 95 =IF(B2>=90,"₹10,000",IF(B2>=75,"₹7,000","₹5,000")) ₹10,000
Meena 78 =IF(B3>=90,"₹10,000",IF(B3>=75,"₹7,000","₹5,000")) ₹7,000

Example 10 — IF with AND + OR Combination

=IF(AND(B2>80,OR(C2="Yes",C2="Y")),"Reward","No Reward")

Numeric और text दोनों conditions की एक साथ जाँच करता है।


Example 11 — IF + AVERAGE

=IF(AVERAGE(B2:B5)>60,"Good","Poor")

यदि औसत अंक 60 से ऊपर हैं → “Good”।


Example 12 — IF with ISERROR (Error Handling)

=IF(ISERROR(A1/B1),"Error",A1/B1)

आपकी रिपोर्ट में #DIV/0! errors दिखाने से बचाता है।


Example 13 — IF with Text Length (LEN)

=IF(LEN(A2)>10,"Long Text","Short Text")

जाँचता है कि किसी text में कितने अक्षर हैं।


Example 14 — IF with VLOOKUP

=IFERROR(VLOOKUP(A2,Table1,2,FALSE),"Not Found")

यदि lookup fail हो जाता है, तो यह #N/A के बजाय “Not Found” दिखाता है।


Example 15 — IF + IFS Function (Simplified)

Excel 2016 और नए versions के लिए:

=IFS(A2>=90,"A",A2>=80,"B",A2>=70,"C",A2>=60,"D",TRUE,"F")

लम्बी nested IF श्रृंखलाओं की कोई आवश्यकता नहीं।


Example 16 — Real-Life Scenarios

Use Case Description Formula
Student Grading Check pass/fail =IF(B2>=40,"Pass","Fail")
Bonus Calculation Multi-condition =IF(B2>90,"High",IF(B2>75,"Medium","Low"))
Attendance Check P or A =IF(C2="P","Present","Absent")
Due Dates Status alert =IF(A2<TODAY(),"Overdue","On Time")
Stock Alert Reorder level =IF(B2<10,"Reorder","OK")

Common Mistakes to Avoid

Mistake Reason Fix
Missing quotes for text Excel won’t understand text "Pass" not Pass
Too many nested IFs Hard to debug Use IFS()
Unclosed parentheses Syntax error Always close )
Comparing text to numbers False logic Match data type

Expert Tips

  1. IF is not case-sensitive (Excel = excel).
  2. Use & to join text:
  3. =IF(A1>50,"Pass: "&A1,"Fail: "&A1)
  4. To show a blank cell:
  5. =IF(A1>50,"","Fail")
  6. Combine with Conditional Formatting to color results.
  7. For many conditions, use IFS or SWITCH (Excel 2016+).

Summary Table

Function Description Example Result
IF Simple condition =IF(A1>10,"Yes","No") Yes/No
IF + AND All true =IF(AND(A1>10,B1>10),"OK","NO") OK
IF + OR Any true =IF(OR(A1>10,B1>10),"OK","NO") OK
IFERROR Hide error =IFERROR(A1/B1,"Error") Error
IF + Date Date check =IF(A1 Past/Future
IFS Multiple tests =IFS(A1>90,"A",A1>80,"B") A/B

आपको IF function में Master क्यों हासिल करनी चाहिए?

IF function निम्न के लिए आधारभूत है:

  • Data analysis
  • Automated grading
  • Dynamic reporting
  • Business logic
  • KPI dashboards

जब इसे Excel 365 की dynamic array features के साथ combine किया जाता है, तो यह और भी अधिक शक्तिशाली हो जाता है - जिससे entire ranges का एक साथ evaluation किया जा सकता है।


Conclusion

IF function, Microsoft Excel के सबसे ज़रूरी और versatile tools में से एक है। यह users को सीधे अपनी spreadsheets में logical निर्णय लेने की क्षमता प्रदान करता है—जिससे Excel defined conditions के आधार पर "think" और प्रतिक्रिया दे सकता है। किसी specific condition के सही या गलत होने का परीक्षण करके, IF function कार्यों को स्वचालित करने, manual intervention को कम करने और consistent data analysis सुनिश्चित करने में मदद करता है।

एक टिप्पणी भेजें

0 टिप्पणियाँ