Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6858865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:12:46+00:00 2026-05-27T02:12:46+00:00

I want delete text and hyphen to the right, in Excel. My column example:

  • 0

I want delete text and hyphen to the right, in Excel.

My column example:

Fresh Start Recovery, Inc. - Wayne
FSA Property Mgmt - Danny
Georgia Securing Svcs, Inc. - Katrina
Georgia - SFFS - Joe & Roxana
Greenwood - Lonnie
Griffis Recovery, LLC - Tyler (5% WC)
Hi Cap, Inc. - Doug

I need the it to look like this:

Fresh Start Recovery, Inc.
FSA Property Mgmt
Georgia Securing Svcs, Inc.
Georgia - SFFS
Greenwood
Griffis Recovery, LLC
Hi Cap, Inc.

I have code that will delete the text and hyphen to the right, but if I have two hyphens I need it to delete the second one, my code deletes the first one.

Dim iPos As String
Dim c As Range

For Each c In Range("a1:a" & Range("a" & Rows.Count).End(xlUp).Row)
iPos = InStr(1, c.Value, " - ")
If iPos > 0 Then
c.Value = Left(c.Value, iPos - 1)
End If
Next
End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T02:12:47+00:00Added an answer on May 27, 2026 at 2:12 am

    InStrRev finds the last string match by looking backwards.

    This updated code

    • uses variant arrays for speed rather than range loops
    • tests for a ” -” then uses InStrRev to find the position of the last occurrence
    • uses the string function Left$ rather than the variant Left

      Sub Test()
      Dim rng1 As Range
      Dim X
      Dim lngrow As Long
      Set rng1 = Range([a1], Cells(Rows.Count, "A").End(xlUp))
      X = rng1.Value2
      For lngrow = 1 To UBound(X)
      If InStr(X(lngrow, 1), " -") Then X(lngrow, 1) = Left$(X(lngrow, 1), InStrRev(X(lngrow, 1), " -", , vbBinaryCompare) - 1)
      Next
      rng1.Value2 = X
      End Sub
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to delete a range of data from a text file using PHP.
I want to delete an DOM element right after fading out. What I did
I want to delete Linefeed in text file using batch file. Is it possible
I have a textView with some text in it. I want to delete the
I want to delete text from multiple files. It could be from 10 to
I want to delete text after the first colon : (inclusive), or replace it
I want to delete a char/string from a binary/text file. If I know the
I am scraping HTML file using BeautifulSoup in python. I want to delete text
I want to delete some certain characters that used wrongly in a string. ........I.wanna.delete.only.the.dots.outside.of.this.text...............
I want to delete all lines from old log files and keep fresh 50

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.