Excel Tutorial
Excel tutorials, quizzes & AI guides — all levels
RSS
  • Online Excel Exercises
  • Training
  • Excel Tests
  • Sitemap
  • Premium Quizzes
  • Shop
  • My account

The SEARCH function in Excel: return character’s position

Text functions
Reading time: 2 minutes
Views: 4,838

The SEARCH function in Excel finds text inside a longer string. It returns the character’s position. This function is helpful for file tasks.

  • You can find a backslash ( \ ) in a path
  • or a dash ( - ) in a phone number.
  • It also finds a space ( ) between first and last names.

How to write the SEARCH function

The SEARCH function has three parts: SEARCH(find_text, within_text, [start_num])

  1. Find_text: The text you want to find. For example, to find a backslash, enter “\”.
  2. Within_text: The text where you search. For example, “C:\Users\Documents\File.xlsx”.
  3. Start_num (optional): Where Excel starts looking. If blank, it starts at the beginning.

If find_text is not found, the SEARCH function returns #VALUE! To handle this error, use IFERROR.

For example, =IFERROR(SEARCH("\", "C:\Users\Documents\File.xlsx"), "Not Found") returns “Not Found” instead of #VALUE! 😉

Example to use the SEARCH function

Here is how to use SEARCH to find the first backslash in a path file. This example returns the position of the first ( \ ) in the path. The result is 3 (the third position in the string).

SEARCH function returns the position of a character in a string

To find more backslashes, set a start position:

=SEARCH(“\”, “C:\Users\Documents\MyFile.xlsx”, SEARCH(“\”, “C:\Users\Documents\MyFile.xlsx”) + 1)

How to find the second character with the SEARCH function

This example finds the next \ in the file path. It helps separate folders in complex paths. Remember, SEARCH is not case-sensitive. This makes it good for file paths.

New Excel functions to extract on a delimiter

Finding the last backslash ( \ ) using many SEARCH functions can be hard ☹️🫤

Luckily, Excel’s TEXTAFTER and TEXTBEFORE functions simplify this. They make finding parts of file paths easier.

Negative value to extract from the right of the string

Related Articles

  • Extract text with AI in Excel with FlashFill
  • Split Text on a Delimiter without Formula
  • Mastering TEXTBEFORE and TEXTAFTER in Excel

Frédéric LE GUEN

SEARCH

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Most Viewed Posts

  • Displaying Negative Numbers in Parentheses in Excel (310,065)
  • Top 10 Excel Functions You Must Know (232,001)
  • How to make automatic calendar in Excel (212,775)
  • Dash for a zero in Excel automatically (190,812)
  • Converting a Date from YYYYMMDD to DD/MM/YYYY in Excel (171,033)
image excel exercises
Excel Exercises
image excel quizzes
Excel Quizzes

The SEARCH function in Excel: return character’s position

Reading time: 2 minutes
Views: 4,838

The SEARCH function in Excel finds text inside a longer string. It returns the character’s position. This function is helpful for file tasks.

  • You can find a backslash ( \ ) in a path
  • or a dash ( - ) in a phone number.
  • It also finds a space ( ) between first and last names.

How to write the SEARCH function

The SEARCH function has three parts: SEARCH(find_text, within_text, [start_num])

  1. Find_text: The text you want to find. For example, to find a backslash, enter “\”.
  2. Within_text: The text where you search. For example, “C:\Users\Documents\File.xlsx”.
  3. Start_num (optional): Where Excel starts looking. If blank, it starts at the beginning.

If find_text is not found, the SEARCH function returns #VALUE! To handle this error, use IFERROR.

For example, =IFERROR(SEARCH("\", "C:\Users\Documents\File.xlsx"), "Not Found") returns “Not Found” instead of #VALUE! 😉

Example to use the SEARCH function

Here is how to use SEARCH to find the first backslash in a path file. This example returns the position of the first ( \ ) in the path. The result is 3 (the third position in the string).

SEARCH function returns the position of a character in a string

To find more backslashes, set a start position:

=SEARCH(“\”, “C:\Users\Documents\MyFile.xlsx”, SEARCH(“\”, “C:\Users\Documents\MyFile.xlsx”) + 1)

How to find the second character with the SEARCH function

This example finds the next \ in the file path. It helps separate folders in complex paths. Remember, SEARCH is not case-sensitive. This makes it good for file paths.

New Excel functions to extract on a delimiter

Finding the last backslash ( \ ) using many SEARCH functions can be hard ☹️🫤

Luckily, Excel’s TEXTAFTER and TEXTBEFORE functions simplify this. They make finding parts of file paths easier.

Negative value to extract from the right of the string

Related Articles

  • Extract text with AI in Excel with FlashFill
  • Split Text on a Delimiter without Formula
  • Mastering TEXTBEFORE and TEXTAFTER in Excel

Tags: SEARCH

Frédéric LE GUEN

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Contact us
About me 
Privacy Policy

© 2022 – 2026 – excel-tutorial.com. All Rights Reserved.
Excel Tutorial is managed by majordome du net

Contact us
About me 
Privacy Policy

© 2022 – 2026 – excel-tutorial.com. All Rights Reserved.
Excel Tutorial is managed by majordome du net