Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7874889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:53:21+00:00 2026-06-03T02:53:21+00:00

Excel’s if function takes three arguments, a condition, an if-true value, and an if-false

  • 0

Excel’s if function takes three arguments, a condition, an if-true value, and an if-false value. Does Excel work out the value of all three arguments, or does it only work out the value of the condition and the corresponding result?

Clarification: I’m not wondering what the result of the if will be, I’m wondering whether or not it calculates the value of all arguments before calculating the result of the function.

This is equivalent to asking whether or not the if function uses lazy or strict evaluation. For example, the following pseudocode:

x = 5;
print x>2 ? "Bigger" : "Smaller" + 1/0

would throw a divide-by-zero exception in a language with fully strict evaluation, as it would evaluate the 1/0, even though the result wouldn’t be required for the ?: operator.

In a lazy-evaluation language, the ?: operator would evaluate x>2 before even deciding which expression to evaluate.

The problem is that in Excel, 1/0 produces a legitimate value (which happens to be #DIV/0!) that can exist in expressions. Therefore, simply calling =if(true,1,1/0) doesn’t show whether Excel is evaluating the 1/0 or not.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T02:53:23+00:00Added an answer on June 3, 2026 at 2:53 am

    Very east to test

    ? iif(true, 1, 1/0) 'run-time error: division by zero
    

    I’m assuming you really mean iif() – in VBA this does not “short-circuit”, so you should use If..Then..Else..End If in cases where that could be a problem.

    Ok – testing what you really asked:

    'In a VBA module
    Function TruePart()
          MsgBox "True part"
          TruePart = "True"
    End Function
    
    
    Function FalsePart()
          MsgBox "False part"
          FalsePart = "False"
    End Function
    

    In a cell: =IF(TRUE,truepart(),falsepart())

    Only get one msgbox per calculation of the IF() cell.

    As further validation, this gives you two msgbox – one for each:

    Sub Tester()
        Debug.Print IIf(True, TruePart(), FalsePart())
    End Sub 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Excel has a lookup function that finds a specified value in a row or
In Excel we have the VLOOKUP function that looks for a value in a
Excel: What function can I use to take the all the characters from the
Excel has the KURT function that returns the kurtosis of a data set. Does
In Excel, let's say I have 5 columns, but not all of the time
Excel 2003 had a simple ...interior.colorindex and only 56 numbers. But, this is changed
Excel's NETWORKDAYS function returns the net working days between two dates. Is there a
Versions Excel 2003 Windows XP SimaPro 7.3.0 Developer Version Using a Work computer but
Excel has NETWORKDAYS() function that find the number of business days between two dates.
Using Excel Interop, I'm attempting to loop through all QueryTables in all Worksheets and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.