Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Checking for an Entry in a Cell.
Written by Allen Wyatt (last updated October 5, 2024)
This tip applies to Excel 97, 2000, 2002, and 2003
There are times when it is helpful to know if a cell contains something—it doesn't really matter what it contains, just so it contains something. In these instances there are two ways you can approach the problem.
The first solution is to simply use the LEN function to determine if there is a length to what is contained in a cell. For instance, let's say you wanted to check if there was a value in cell F1. You could use the following:
=IF(LEN(F1)>0,"Found something there","Nothing is there")
If there is nothing in cell F1, then the length will be equal to zero. If there is something in the cell, even a number, then the length will be greater than zero.
The second solution is a variation on the LEN approach. All you need to do is check to see if there is anything in the cell. This may sound odd, but it is easier when you see the formula. For example, the following will check to see if there is anything in cell B4:
=IF(B4<>"","Found something there","Nothing is there")
The test in this formula is True if there is anything in the cell. If the cell is empty, then the test fails.
Another solution you can use is the ISBLANK worksheet function. This function returns True if the target cell is blank, and False if it contains anything.
As an example, let's suppose you want to check if the user has entered something in cell D7. You can use the following to make the determination:
=IF(ISBLANK(D7),"Input values missing",D7)
In this case the cell containing this formula would contain the same value as in D7, provided something was there. If there is nothing in D7, then the cell contains the text "Input values missing."
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2112) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Checking for an Entry in a Cell.
Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!
Each time you take some action in Excel, the action is saved in an "undo stack" so that the action can be undone, if ...
Discover MoreOne way to make your worksheets less complex is to get rid of detail and keep only the summary of that detail. Here's how ...
Discover MoreIf you hide the first rows of a worksheet, you may have a hard time getting those rows visible again. Here's a simple way ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments