If any cells are blank excel

Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel 2021 Excel 2021 for Mac Excel 2019 Excel 2019 for Mac Excel 2016 Excel 2016 for Mac Excel 2013 Excel 2010 Excel 2007 Excel for Mac 2011 More…Less

Sometimes you need to check if a cell is blank, generally because you might not want a formula to display a result without input.

Formula in cell E2 is =IF(D2=1,"Yes",IF(D2=2,"No","Maybe"))

In this case we’re using IF with the ISBLANK function:

  • =IF(ISBLANK(D2),»Blank»,»Not Blank»)

Which says IF(D2 is blank, then return «Blank», otherwise return «Not Blank»). You could just as easily use your own formula for the «Not Blank» condition as well. In the next example we’re using «» instead of ISBLANK. The «» essentially means «nothing».

Checking if a cell is blank - Formula in cell E2 is =IF(ISBLANK(D2),"Blank","Not Blank")

=IF(D3=»»,»Blank»,»Not Blank»)

This formula says IF(D3 is nothing, then return «Blank», otherwise «Not Blank»). Here is an example of a very common method of using «» to prevent a formula from calculating if a dependent cell is blank:

  • =IF(D3=»»,»»,YourFormula())

    IF(D3 is nothing, then return nothing, otherwise calculate your formula).

Need more help?

The logical expression =»» means «is empty». In the example shown, column D contains a date if a task has been completed. In column E, a formula checks for blank cells in column D. If a cell is blank, the result is a status of «Open». If the cell contains value (a date in this case, but it could be any value) the formula returns «Closed».

The effect of showing «Closed» in light gray is accomplished with a conditional formatting rule.

Display nothing if cell is blank

To display nothing if a cell is blank, you can replace the «value if false» argument in the IF function with an empty string («») like this:

=IF(D5="","","Closed")

Alternative with ISBLANK

Excel contains a function made to test for blank cells called ISBLANK. To use the ISBLANK, you can revise the formula as follows:

=IF(ISBLANK(D5),"Open","Closed")

In this article, we will learn:

How To Check If A Cell Is Blank Using IF

How To Check If A Cell Is Blank Using ISBLANK

Count Blank Cells Using COUNTIF

Count Blank Cells Using COUNTBLANK

Assume you have this data.

wer

Let’s just step into the example.

How To Check If A Cell Is Blank Using IF

Generic Formula

=IF(cell_address=»»,TRUE,FALSE)

In the above data, there are some names that are missing. In Column C you want TRUE if it doesn’t have a name and FALSE if it does. It is easy to do this. In C2 write this formula and copy it in the cells below.

efr

The formula simply checks to see if the cell is blank or not. It uses “”  to indicate blank. Prints TRUE  if it is blank, and FALSE if not.

How To Check If A Cell Is Blank Using ISBLANK

Generic Formula

Now the same task can be done easily by using the ISBLANKfunction in excel 2016.

ISBLANK takes only one argument and that is the cell you want to check.

In D2 write this formula and copy it below cells.

This will be your result.
etgr

You got the same answers by giving just one argument in ISBLANK.

Mostly you would want to do something after knowing if the cell is blank or not. This is where IF is necessary.

For example, if you want to print the name Cells of B column has one, and “mystry_man” if it is a blank cell. You can use IF and ISBLANK in excel together.

In Range E2, write this formula:

wr

Count Blank Cells Using COUNTIF

Generic Formula

Now if you want to know how many blank cells there are, you can use this formula.

In any version of Excel 2016, 2013, 2010, write this formula in any cell.

fteg

We have our answer as 7 for this example.

Now if you want to know how many names there are, you need to count if not blank. Use the COUNTA function to count non-blank cells in a range.

wwer

Count Blank Cells Using COUNTBLANK

Generic Formula

COUNTA counts if cell contains any text and the COUNTBLANK function counts all blank cells in a range in Excel. It only requires one argument to count empty cells in a range.

In cell G2, enter this formula:

ery

COUNTBLANK will find blank cells in excel of the given range.

We learned how to work with blank cells in excel, how to find blank cells, how to count blank cells in a range, how to check if a cell is empty or not, how to manipulate blank cells etc.

Related Articles:

How to Calculate Only If Cell is Not Blank in Excel

Adjusting a Formula to Return a Blank

Checking Whether Cells in a Range are Blank, and Counting the Blank Cells

SUMIF with non-blank cells

Only Return Results from Non-Blank Cells

Popular Articles:

50 Excel Shortcuts to Increase Your Productivity

How to use the VLOOKUP Function in Excel

How to use the COUNTIF function in Excel

How to use the SUMIF Function in Excel

Содержание

  1. If cell is not blank
  2. Related functions
  3. Summary
  4. Generic formula
  5. Explanation
  6. IF function
  7. ISBLANK function
  8. LEN function
  9. Excel ISBLANK function to check if cell is empty or not
  10. Excel ISBLANK function
  11. ISBLANK in Excel — things to remember
  12. How to use ISBLANK in Excel
  13. Excel formula: if cell is blank then
  14. Excel formula: if cell is not blank then
  15. If cell is blank, then leave blank
  16. If any cell in range is blank, then do something
  17. If all cells in range are blank, then do something
  18. Excel formula: if cell is not blank, then sum
  19. If not blank then sum
  20. If blank then sum
  21. Sum if all cells in range are not blank
  22. Excel formula: count if cell is not blank
  23. Excel ISBLANK not working
  24. Treat zero-length strings as blanks
  25. Remove or ignore extra spaces

If cell is not blank

Summary

To test if a cell is not blank (i.e. has content), you can use a formula based on the IF function. In the example shown, the formula in cell E5 is:

As the formula is copied down it returns «Done» when a cell in column D is not blank and an empty string («») if the cell is blank.

Generic formula

Explanation

In this example, the goal is to create a formula that will return «Done» in column E when a cell in column D contains a value. In other words, if the cell in column D is «not blank», then the formula should return «Done». In the worksheet shown, column D is is used to record the date a task was completed. Therefore, if the column contains a date (i.e. is not blank), we can assume the task is complete. This problem can be solved with the IF function alone or with the IF function and the ISBLANK function. It can also be solved with the LEN function. All three approaches are explained below.

IF function

The IF function runs a logical test and returns one value for a TRUE result, and another value for a FALSE result. You can use IF to test for a blank cell like this:

In the first example, we test if A1 is empty with =»». In the second example, the <> symbol is a logical operator that means «not equal to», so the expression A1<>«» means A1 is «not empty». In the worksheet shown, we use the second idea in cell E5 like this:

If D5 is «not empty», the result is «Done». If D5 is empty, IF returns an empty string («») which displays as nothing. As the formula is copied down, it returns «Done» only when a cell in column D contains a value. To display both «Done» and «Not done», you can adjust the formula like this:

ISBLANK function

Another way to solve this problem is with the ISBLANK function. The ISBLANK function returns TRUE when a cell is empty and FALSE if not. To use ISBLANK directly, you can rewrite the formula like this:

Notice the TRUE and FALSE results have been swapped. The logic now is if cell D5 is blank. To maintain the original logic, you can nest ISBLANK inside the NOT function like this:

The NOT function simply reverses the result returned by ISBLANK.

LEN function

One problem with testing for blank cells in Excel is that ISBLANK(A1) or A1=»» will both return FALSE if A1 contains a formula that returns an empty string. In other words, if a formula returns an empty string in a cell, Excel interprets the cell as «not empty». To work around this problem, you can use the LEN function to test for characters in a cell like this:

This is a much more literal formula. We are not asking Excel if A1 is blank, we are literally counting the characters in A1. The LEN function will return a positive number only when a cell contains actual characters.

Источник

Excel ISBLANK function to check if cell is empty or not

by Svetlana Cheusheva, updated on March 14, 2023

The tutorial shows how to use ISBLANK and other functions to identify blank cells in Excel and take different actions depending on whether a cell is empty or not.

There are many situations when you need to check if a cell is empty or not. For instance, if cell is blank, then you might want to sum, count, copy a value from another cell, or do nothing. In these scenarios, ISBLANK is the right function to use, sometimes alone, but most often in combination with other Excel functions.

Excel ISBLANK function

The ISBLANK function in Excel checks whether a cell is blank or not. Like other IS functions, it always returns a Boolean value as the result: TRUE if a cell is empty and FALSE if a cell is not empty.

The syntax of ISBLANK assumes just one argument:

Where value is a reference to the cell you want to test.

For example, to find out if cell A2 is empty, use this formula:

To check if A2 is not empty, use ISBLANK together with the NOT function, which returns the reversed logical value, i.e. TRUE for non-blanks and FALSE for blanks.

Copy the formulas down to a few more cells and you will get this result:

ISBLANK in Excel — things to remember

The main point you should keep in mind is that the Excel ISBLANK function identifies truly empty cells, i.e. cells that contain absolutely nothing: no spaces, no tabs, no carriage returns, nothing that only appears blank in a view.

For a cell that looks blank, but in fact is not, an ISBLANK formula returns FALSE. This behavior occurs if a cell contains any of the following:

  • Formula that returns an empty string like IF(A1<>«», A1, «»).
  • Zero-length string imported from an external database or resulted from a copy/paste operation.
  • Spaces, apostrophes, non-breaking spaces ( ), linefeed or other non-printing characters.

How to use ISBLANK in Excel

To gain more understanding of what the ISBLANK function is capable of, let’s take a look at some practical examples.

Excel formula: if cell is blank then

Since Microsoft Excel does not have a built-in IFBLANK kind of function, you need to use IF and ISBLANK together to test a cell and perform an action if the cell is empty.

Here’s the generic version:

To see it in action, let’s check if a cell in column B (delivery date) has any value in it. If the cell is blank, then output «Open»; if the cell is not blank, then output «Completed».

=IF(ISBLANK(B2), «Open», «Completed»)

Please remember that the ISBLANK function only determines absolutely blank cells. If a cell contains something invisible to the human eye such as a zero-length string, ISBLANK would return FALSE. To illustrate this, please have a look at the screenshot below. The dates in column B are pulled from another sheet with this formula:

As the result, B4 and B6 contain empty strings («»). For these cells, our IF ISBLANK formula yields «Completed» because in terms of ISBLANK the cells are not empty.

If your classification of «blanks» includes cells containing a formula that results in an empty string, then use =»» for the logical test:

=IF(B2=»», «Open», «Completed»)

The screenshot below shows the difference:

Excel formula: if cell is not blank then

If you’ve closely followed the previous example and understood the formula’s logic, you should have no difficulties with modifying it for a specific case when an action shall only be taken when the cell is not empty.

Based on your definition of «blanks», choose one of the following approaches.

To identify only truly non-blank cells, reverse the logical value returned by ISBLANK by wrapping it into NOT:

Or use the already familiar IF ISBLANK formula (please notice that compared to the previous one, the value_if_true and value_if_false values are swapped):

To teat zero-length strings as blanks, use <>«» for the logical test of IF:

For our sample table, any of the below formulas will work a treat. They all will return «Completed» in column C if a cell in column B is not empty:

=IF(B2<>«», «Completed», «»)

If cell is blank, then leave blank

In certain scenarios, you may need a formula of this kind: If cell is blank do nothing, otherwise take some action. In fact, it’s nothing else but a variation of the generic IF ISBLANK formula discussed above, in which you supply an empty string («») for the value_if_true argument and the desired value/formula/expression for value_if_false.

For absolutely blank cells:

To regard empty strings as blanks:

In the table below, suppose you want to do the following:

  • If column B is empty, leave column C empty.
  • If column B contains a sales number, calculate the 10% commission.

To have it done, we multiply the amount in B2 by percentage and put the expression in the third argument of IF:

After copying the formula through column C, the result looks as follows:

If any cell in range is blank, then do something

In Microsoft Excel, there are a few different ways to check a range for empty cells. We will be using an IF statement to output one value if there is at least one empty cell in the range and another value if there are no empty cells at all. In the logical test, we calculate the total number of empty cells in the range, and then check if the count is greater than zero. This can be done with either COUNTBLANK or COUNTIF function:

Or a little bit more complex SUMPRODUCT formula:

For example, to assign the «Open» status to any project that has one or more blanks in columns B through D, you can use any of the below formulas:

=IF(SUMPRODUCT(—(B2:D2=»»))>0, «Open», «»)

Note. All these formulas treat empty strings as blanks.

If all cells in range are blank, then do something

To check if all cells in the range are empty, we will be using the same approach as in the above example. The difference is in the logical test of IF. This time, we count cells that are not empty. If the result is greater than zero (i.e. the logical test evaluates to TRUE), we know that not every cell in the range is blank. If the logical test is FALSE, that means all cells in the range are blank. So, we supply the desired value/expression/formula in the 3 rd argument of IF (value_if_false).

In this example, we will return «Not Started» for projects that have blanks for all the milestones in columns B through D.

The easiest way to count non-empty cells in Excel is by using the COUNTA function:

=IF(COUNTA(B2:D2)>0, «», «Not Started»)

Another way is COUNTIF for non-blanks («<>» as the criteria):

=IF(COUNTIF(B2:D2,»<>«)>0, «», «Not Started»)

Or the SUMPRODUCT function with the same logic:

=IF(SUMPRODUCT(—(B2:D2<>«»))>0, «», «Not Started»)

ISBLANK can also be used, but only as an array formula, which should be completed by pressing Ctrl + Shift + Enter , and in combination with the AND function. AND is needed for the logical test to evaluate to TRUE only when the result of ISBLANK for each cell is TRUE.

=IF(AND(ISBLANK(B2:D2)), «Not Started», «»)

Note. When choosing a formula for your worksheet, an important thing to consider is your understanding of «blanks». The formulas based on ISBLANK, COUNTA and COUNTIF with «<>» as the criteria look for absolutely empty cells. SUMPRODUCT also regards empty strings as blanks.

Excel formula: if cell is not blank, then sum

To sum certain cells when other cells are not blank, use the SUMIF function, which is especially designed for conditional sum.

In the table below, supposing you wish to find the total amount for the items that are already delivered and those that are not yet delivered.

If not blank then sum

To get the total of delivered items, check if the Delivery date in column B is not blank and if it isn’t, then sum the value in column C:

If blank then sum

To get the total of undelivered items, sum if the Delivery date in column B is blank:

=SUMIF(B2:B6, «», C2:C6)

Sum if all cells in range are not blank

To sum cells or perform some other calculation only when all cells in a given range are not blank, you can again use the IF function with the appropriate logical test.

For example, COUNTBLANK can bring us the total number of blanks in the range B2:B6. If the count is zero, we run the SUM formula; otherwise do nothing:

=IF(COUNTBLANK(B2:B6)=0, SUM(B2:B6), «»)

The same result can be achieved with an array IF ISBLANK SUM formula (please remember to press Ctrl + Shift + Enter to complete it correctly):

In this case, we use ISBLANK in combination with the OR function, so the logical test is TRUE if there is at least one blank cell in the range. Consequently, the SUM function goes to the value_if_false argument.

Excel formula: count if cell is not blank

As you probably know, Excel has a special function to count non-empty cells, the COUNTA function. Please be aware that the function counts cells containing any type of data, including the logical values of TRUE and FALSE, error, spaces, empty strings, etc.

For example, to count non-blank cells in the range B2:B6, this is the formula to use:

The same result can be achieved by using COUNTIF with the non-blank criteria («<>«):

To count blank cells, use the COUNTBLANK function:

=COUNTBLANK(B2:B6)

Excel ISBLANK not working

As already mentioned, ISBLANK in Excel returns TRUE only for really empty cells that contain absolutely nothing. For seemingly blank cells containing formulas that produce empty strings, spaces, apostrophes, non-printing characters, and the like, ISBLANK returns FALSE.

In a situation, when you want to treat visually empty cells as blanks, consider the following workarounds.

Treat zero-length strings as blanks

To consider cells with zero-length strings as blanks, in the logical test of IF, put either an empty string («») or the LEN function equal to zero.

=IF(A2=»», «blank», «not blank»)

=IF(LEN(A2)=0, «blank», «not blank»)

In case the ISBLANK function is malfunctioning because of blank spaces, the most obvious solution is to get rid of them. The following tutorial explains how to quickly remove leading, trailing and multiple in-between spaces, except for a single space character between words: How to remove extra spaces in Excel.

If for some reason removing excess spaces does not work for you, you can force Excel to ignore them.

To regard cells containing only space characters as empty, include LEN(TRIM(cell))=0 in the logical test of IF as an additional condition:

=IF(OR(A2=»», LEN(TRIM(A2))=0), «blank», «not blank»)

To ignore a specific non-printing character, find its code and supply it to the CHAR function.

For example, to identify cells containing empty strings and nonbreaking spaces ( ) as blanks, use the following formula, where 160 is the character code for a nonbreaking space:

=IF(OR(A2=»», A2=CHAR(160)), «blank», «not blank»)

That’s how to use the ISBLANK function to identify blank cells in Excel. I thank you for reading and hope to see you on our blog next week!

Источник

Home / Excel Formulas / IF Cell is Blank (Empty) using IF + ISBLANK

In Excel, if you want to check if a cell is blank or not, you can use a combination formula of IF and ISBLANK. These two formulas work in a way where ISBLANK checks for the cell value and then IF returns a meaningful full message (specified by you) in return.

In the following example, you have a list of numbers where you have a few cells blank.

Formula to Check IF a Cell is Blank or Not (Empty)

  1. First, in cell B1, enter IF in the cell.
  2. Now, in the first argument, enter the ISBLANK and refer to cell A1 and enter the closing parentheses.
  3. Next, in the second argument, use the “Blank” value.
  4. After that, in the third argument, use “Non-Blank”.
  5. In the end, close the function, hit enter, and drag the formula up to the last value that you have in the list.

As you can see, we have the value “Blank” for the cell where the cell is empty in column A.

=IF(ISBLANK(A1),"Blank","Non-Blank")

Now let’s understand this formula. In the first part where we have the ISBLANK which checks if the cells are blank or not.

And, after that, if the value returned by the ISBLANK is TRUE, IF will return “Blank”, and if the value returned by the ISBLANK is FALSE IF will return “Non_Blank”.

Alternate Formula

You can also use an alternate formula where you just need to use the IF function. Now in the function, you just need to specify the cell where you want to test the condition and then use an equal operator with the blank value to create a condition to test.

And you just need to specify two values that you want to get the condition TRUE or FALSE.

Download Sample File

  • Ready

And, if you want to Get Smarter than Your Colleagues check out these FREE COURSES to Learn Excel, Excel Skills, and Excel Tips and Tricks.

Понравилась статья? Поделить с друзьями:
  • If any cell contains value excel
  • If function excel for dates
  • Idioms with word feet
  • If and when in excel
  • Idioms with word change