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 More…Less
This topic provides help for the most common scenarios for the #VALUE! error in the FIND/FINDB and SEARCH/SEARCHB functions.
A few things to know about FIND and SEARCH functions
-
The FIND and SEARCH functions are very similar. They both work in the same way — locate a character or a text string in another text string. The difference between these two functions is that FIND is case-sensitive, and SEARCH is not case-sensitive. So if you don’t want to match case in a text string, use SEARCH.
-
If you want a function that returns the string based on the character number you specify, use the MID function along with FIND. You can find information and examples of using MID and FIND combinations in the FIND help topic.
-
The syntax of these functions is the same, find_text, within_text, [start_num]). In simple English, the syntax means What do you want to find?, Where do you want to find it?, What position do you want to start from?
Problem: the value in the find_text argument cannot be found in the within_text string
If the function cannot find the text to be found in the specified text string, it will throw a #VALUE! error.
For example, a function like:
-
=FIND(«gloves»,»Gloves (Youth)»,1)
Will throw the #VALUE! error, because there is no matching “gloves” in the string, but there is “Gloves”. Remember that FIND is case-sensitive, so make sure the value in find_text has an exact match in the string in the within_text argument.
However, this SEARCH function will return a value of 1, since it’s not case-sensitive:
-
=SEARCH(«gloves»,»Gloves (Youth)»,1)
Solution: Correct the syntax as necessary.
Problem: The start_num argument is set to zero (0)
The start_num argument is an optional argument, and if you omit it, the default value will be assumed to be 1. However, if the argument is present in the syntax and the value is set to 0, you will see the #VALUE! error.
Solution: Remove the start_num argument if it is not required, or set it to the correct appropriate value.
Problem: The start_num argument is greater than the within_text argument
For example, the function:
-
=FIND(“s”,”Functions and formulas”,25)
Looks for “s” in the “Functions and formulas” string (within_text) starting at the 25th character (start_num), but returns a #VALUE! error because there are only 22 characters in the string.
Tip: To find the total number of characters in a text string, use the LEN function
Solution: Correct the starting number as necessary.
Need more help?
You can always ask an expert in the Excel Tech Community or get support in the Answers community.
See Also
Correct a #VALUE! error
FIND/FINDB functions
SEARCH/SEARCHB FUNCTIONS
Overview of formulas in Excel
How to avoid broken formulas
Detect errors in formulas
All Excel functions (alphabetical)
All Excel functions (by category)
Need more help?
The Find function in Excel is a text function that returns the position of a set character on a cell item. As the function is tricky to use, many new Excel users experience issues in running the Find function.
The Find function is case-sensitive in nature. This means you need to match the case of the character you want the function to return the value for. If you do not match the case, you might encounter the #VALUE! Error. There are other rookie errors as such that can create problems when using the Find function.
Use Proper Syntax
If you do not use proper syntax while entering the FIND function, you will run into the #NAME? error code. The formula for the FIND function is written in the following format:
=FIND(find_text, within_text, [start-num])
You can either refer to a cell or enter a text in place of “find_text”. If you’ve entered text, be sure to enter it inside double quotes. Similarly, be sure to use commas to separate your arguments.
In this example, we set the find_text value as I. As we did not enclose it inside double quotes, Excel triggered the #NAME? error.
To solve this, enter your text in double-quotes. The FIND function returns 1 as the letter “I” appears only once in “Image”.
Recheck Your Formula
You could have entered an incorrect value in the find_text section. If Excel cannot find the value you’ve requested in the set cell location, it will return the #VALUE! error.
Check your formula to see if you’ve correctly entered your values. If you’ve used a different case in your formula, change it to match the case.
We’ve entered the find_text
value as “A” in the grid above. The FIND function will look for this character in A2, which is “apple”. As the case for the letter “a” is different, the FIND function will not work.
You can solve this error by changing the case for find_text
to “a”.
Change start-num Value
You can add a start-num value at the end of your FIND formula. This specifies a position in the character Excel can start looking for your set value. If you’ve set a start-num value that comes after your set character, Excel will not register that character.
For example, we’ve entered our formula to find the number of times the letter “a” has been repeated in apple. However, we’ve set the start-num
value to 2, which comes after “a” in the value. Excel cannot locate “a” in the remaining text, so it returns the #VALUE! error.
To fix this, we can change the start-num
value to 1. However, you can choose not to enter 1 at all as Excel sets the start-num
value to 1 by default.
Use Find Command in Excel
If you’re having trouble using the FIND function in Excel, you can always find the Find command. You can configure the Find command to Match case and Match entire cell contents with the value you enter.
Similarly, you can adjust where Excel looks for your set value. You can run the Find command within your sheet or the entire workbook. You can also choose if the command searches by rows or columns in formulas, values, or comments.
- On your workbook, hit Ctrl + F.
- Click on the Options>> button.
- Enter your value in the Find what section and configure the search settings accordingly.
- Select Find All.
The Find command will locate all cells that match your set value.
Repair Office
You could be dealing with corrupt or missing program files if non of the solutions apply. You can perform an online repair on the Office app as your last resort to the Find function not working in Excel.
- Open Settings (Windows + I).
- Head to Apps > Apps & features.
- Enter Microsoft Office in the search bar.
- Click the three-dot menu and select Modify.
- Choose Online repair > Repair.
See all How-To Articles
This tutorial demonstrates some fixes for when Find and Replace is not working in Excel.
Common Issues and Fixes for Find Errors
In Excel, the Find & Replace feature makes the searching process faster and easier when you want to find specific information in a worksheet. But sometimes this feature can stop working.
Nonexistent Text
The most common reason for the error is that the string you’re searching doesn’t exist. Say you have a data set with prices in Columns A, B, and C.
If you enter text that doesn’t exist in the workbook in the Find what box and click Find All, Excel displays an error message.
It’s normal to get the error message above if you search for nonexistent text. But if you try to find and replace a text string that does exist in the workbook and you still get this error message, try the following solutions.
Replace All Without Find All
If you forget to click the Find All or Find Next option before clicking the Replace All or Replace option, it results in the error message: Microsoft Excel cannot find a match.
To fix this mistake, first click the Find All (or Find Next) button, and then press the Replace All (or Replace).
Wrong Cell Selection
If it’s only one cell selected, Excel goes through the entire worksheet.
If more than one cell is selected, then the Find option from the Find & Replace feature is only applied to those cells.
So, to fix this problem, check that you made the right cell selection or just select a single cell in order to apply the Find option to the entire worksheet (orworkbook).
Protected Sheet
Another possible reason why Find doesn’t work is that your sheet is protected. In a protected sheet, you can find text, but you won’t be able to make any changes with Replace.
To fix this problem, in the Ribbon, go to Review and click on Unprotect Sheet icon.
In the dialog box, enter the password to unlock it.
As a result, you should be able to use the Find & Replace feature on your worksheet.
Corrupted Excel Worksheet
Sometimes the Find & Replace feature won’t work because the data you are looking for is actually missing from the worksheet due to Excel file corruption. In this case, the best thing you can do is to repair the file using the Restore function.
See also: Using Find and Replace in Excel VBA and Find & Replace Question Marks and Asterisks
Parsing values in a cell using the Find function and overcoming the #VALUE!
result
Picking up value before the find of «&»
=IF(IFERROR(FIND("&",B:B),0)>0,MID(B:B,1,FIND("&",B:B)-1),TRIM(B:B))
Picking up value after the find of «&»
=IF(IFERROR(FIND("&",B:B),0)>0,MID(B:B,FIND("&",B:B)+1,99),"")
Explanation
- Test for error FIND and substitute with 0
- Test using outside If
- Resolve if results
Example: 1
=IF(IFERROR(FIND("&",B:B),0)>0,MID(B:B,FIND("&",B:B)+1,99),"")
- Cell contains Mary & David
- Value becomes 6 for the find
- Starting at position to right pick up value
- Result is «David»
Example: 2
- Cell contains Mary
- Value becomes 0
- Result is null
Example: 3
Picking up value before the «&»
=IF(IFERROR(FIND("&",B:B),0)>0,MID(B:B,1,FIND("&",B:B)-1),TRIM(B:B))
- Cell contains Mary & David
- Result is Mary
invirtus
Пользователь
Сообщений: 33
Регистрация: 27.03.2015
Добрый день всем.
Возникла проблема с методом Find. Вчера убил два часа, но так и не понял, почему он то работает, то нет. Через Find и Offset я пытаюсь сэмулировать экселевский Vlookup. Есть исходный файл с двумя колонками — в первой список ИНН, во второй — список номеров поставщиков. Макрос в testFile находит ИНН (с этим он прекрасно справляется), а потом используя ИНН должен искать мне номер поставщика. Он то работал вчера, то нет. Когда не работал, я сохранял файл, закрывал, открывал, запускал макрос построчно и по коду следил, что происходит после выполнения каждой строки, и он находил поставщика. Потом закрывал файл, открывал, запускал просто так и он не находил поставщика. Выкладываю файл где ищется ИНН и файл со списком поставщиков (готовый макрос не влезает по максимальному объему файла). Необходимый макрос — Sub PriceListShow(). Ниже интересующий меня блок кода, я не пойму, почему он не работает (уже перебрал все возможные варианты, но он так и не ищет строку).
Я начал грешить на то, что у меня String, а в файле со списком поставщиков формат данных «цифровой», но смена переменной на Double никакого результата не принесла.
Как видите ниже, я перепробовал различные варианты запросов (даже vlookup), но опять таки к какому то очевидному пониманию не пришёл. Надеюсь вы мне поможете и/или подскажете, как улучшить код.
Спасибо.
Код |
---|
On Error Resume Next Dim SupplierINN As String Dim SupplierBlockStart As String Dim SupplierBlockEnd As String SupplierBlockStart = Worksheets("Данные поставщика").Range("A1:C100").Find("*Контак*ормация*поставщика*").Address SupplierBlockEnd = Worksheets("Данные поставщика").Range("A1:C100").Find("лицо*поставщика*").Address SupplierINN = Worksheets("Данные поставщика").Range(Worksheets("Данные поставщика").Range(SupplierBlockStart & ":" & SupplierBlockEnd).Find("*ИНН*").Address).Offset(, 1).Value If SupplierINN = Empty Then PriceListAuto.Supplier = "НЕТ ИНН" PriceListAuto.Supplier.BackColor = RGB(254, 230, 61) PriceListAuto.SupplierLabel = "На вкладке ""Данные поставщика"" не указан ИНН. Уточните ИНН / Введите вручную" Else 'xSupplier = Workbooks("PrismaTools.xlsm").Worksheets("Suppliers").Range(Range("A:A").Find(SupplierINN, , , xlPart).Address).Offset(, 2).Value 'If xSupplier = "" Then xSupplier = Workbooks("PrismaTools.xlsm").Worksheets("Suppliers").Range(Range("A:A").Find(SupplierINN, , , xlWhole).Address).Offset(, 2).Value 'If xSupplier = "" Then xSupplier = Workbooks("PrismaTools.xlsm").Worksheets("Suppliers").Range(Range("A:A").Find("*" & SupplierINN & "*", , , xlPart).Address).Offset(, 2).Value 'If xSupplier = "" Then xSupplier = Workbooks("PrismaTools.xlsm").Worksheets("Suppliers").Range(Range("A:A").Find("*" & SupplierINN & "*", , , xlWhole).Address).Offset(, 2).Value If xSupplier = "" Then xSupplier = Workbooks("PrismaTools.xlsm").Worksheets("Suppliers").Application.WorksheetFunction.VLookup(CDbl(SupplierINN), "A:C", 3, 0) xSupplierName = Workbooks("Suppliers.xlsm").Worksheets("Suppliers").Range(Range("C:C").Find(xSupplier, , , xlPart).Address).Offset(, 1).Value If xSupplier = "" Then PriceListAuto.Supplier = "НЕ НАЙДЕН" PriceListAuto.SupplierLabel = "Поставщик не найден. Проверьте список поставщиков или введите номер вручную" Else PriceListAuto.Supplier = xSupplier PriceListAuto.Supplier.BackColor = RGB(107, 198, 6) PriceListAuto.SupplierLabel = xSupplierName End If End If |
Изменено: invirtus — 28.07.2015 10:03:13