Removing last character in a cell, with varying word lengths

DataQuestioner

Board Regular
Joined
Sep 12, 2013
Messages
115
I need to remove the last character in a cell, which is always a "?" - the single words in each cell will have varying lengths, and can commence with a upper or lower case letter, and will contain any of the 26 letters of the alphabet, which could also include a hyphen, e.g.

"day-dream?" should become "day-dream"
"really?" should become "really"
"Unbelievably?" should become "Unbelievably".

I've tried experimenting with "IF" "LEFT" "RIGHT" and "MID" functions, but I haven't got my head around their proper usage yet!

Please help if you can.
 
If you are up for a macro solution like hiker95 posted, then here is another one for you to consider...

Code:
Sub RemoveTrailingQuestionMarks()
  Dim Addr As String
  Addr = "A1:A" & Cells(Rows.Count, "A").End(xlUp).Row
  Range(Addr) = Evaluate(Replace("IF(RIGHT(TRIM(@))=""?"",LEFT(TRIM(@),LEN(TRIM(@))-1),@)", "@", Addr))
End Sub
 
Upvote 0

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Just been revisiting this thread after almost a year.

Thanks to both hiker95 + Rick for their macros.

The macro solution is much quicker than using the Find+Replace function.
 
Upvote 0
DataQuestioner,

Thanks for the feedback.

You are very welcome. Glad we could help.

And, come back anytime.
 
Upvote 0

Forum statistics

Threads
1,216,100
Messages
6,128,824
Members
449,470
Latest member
Subhash Chand

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top