You are here:

Excel/Adding a condition to an "if" formula


Hi Tom!  I have massive file that contains all of our company's sales and use tax data for the month.  The file uses multiple data sources, and the data source names contain either "sales" or "use" within a file name (for example, it may be labeled "abcd-usetax.123-005" or "Kan7365sales99". I need to be able to segregate the use and sales tax without sorting first. Since there is no consistency with file names, I am using this formula to find whether the file is for use tax or sales tax =IF(ISNUMBER(SEARCH("use",C8)),"USE","SALES").  This formula works great; however, there are quite a few lines with blanks in the column I am pulling from, so the formula defaults to "sales".  I'm wondering if there is a way to add a condition to the formula to first confirm that the cell actually contains data.

Any help would be greatly appreciated!

Karon Head,


would be a start.  If that doesn't work


that would ignore a cell that has spaces in it or is actually blank.  

Tom Ogilvy

About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Tom Ogilvy


Selected as an Excel MVP by Microsoft since 1999. Answering Excel questions in Allexperts since its inception in 2001. Able to answer questions on almost all aspects of Excel's internal capabilities. If seeking a VBA solution, please specify that in your question itself so I give you the answer you want. [Excel has weak protection - if you are distributing an application, I don't answer questions on how to protect your project from your users.]


Extensive experience.

Master of Science (MS) degree Operations Research (ORSA)

Awards and Honors
Microsoft MVP in Excel.

©2016 All rights reserved.