Delete Characters After Last Specific Character Occurence

Jun 11, 2008

I have one column with many numbers. Some have one dash and some have two.

Example:
123-123456-65
012-789546-1
98B12354-889

Is there a way that I can remove all characters after the last – (dash) in the number?
Example:

If number is 123-123456-65
Then 123-123456

If number is 98B12354-889
Then 98B12354

If someone could just lead me in a direction, I might be able to figure it out. However, my code is elementary and most of the time, I record macros and the play with the code until it does what I want.

View 3 Replies


ADVERTISEMENT

Delete Last X Characters If It Contains A Certain Character

Dec 8, 2007

Sub rightval()
Dim myrange, mycell As Range
Set myrange = Sheets("Sheet1").Range("A1", Range("A65536").End(xlUp))
For Each mycell In myrange
If Right(mycell.Value, 1) = "." Then
mycell.Value = Left(mycell.Value, Len(mycell.Value) - 3)
End If
Next mycell
End Sub

I'd like to delete the last three values of one cell only if it contains a period.

View 2 Replies View Related

Extract X Number Of Characters Followed By Specific Character

May 23, 2008

How can I extract mid section of the string which is always 5 characters long and is always followed by a period "." ?

My account strings are in 3 sections (but the third section isn't always used)

For example,
1.10210
1.22556.001
900101.56201
955261.54444.001
5566625.58886.957756

View 4 Replies View Related

Delete Rows With Specific Characters In A Specific Column

Dec 10, 2007

Currently I am using the Kickbutt VBA Find Function of Aaron, but I would like to have something that works more efficiently. What I currently do is (assuming all possible values for Column J are A - F):

Find_Range("A", Columns("J"), MatchCase:=True).EntireRow.Delete
Find_Range("B", Columns("J"), MatchCase:=True).EntireRow.Delete
Find_Range("C", Columns("J"), MatchCase:=True).EntireRow.Delete
Find_Range("D", Columns("J"), MatchCase:=True).EntireRow.Delete
Find_Range("E", Columns("J"), MatchCase:=True).EntireRow.Delete

although I just want some code that says: delete all rows except those that have "F" as content in Column J. I already tried something like:

Range("1:65536").Select
For Each cl In Range("J:J")
If cl.Text = "A" Or cl.Text = "B" Or cl.Text = "C" Or cl.Text = "D" Or cl.Text = "E" Then
Rows(cl.Row).Delete
End If
Next

but it also takes much to long. The major problem I think, is that the number of records is variable so I search the entire worksheet...

View 5 Replies View Related

How To Delete All Words Containing Specific Characters

May 14, 2014

I need a formula which can clean up a huge data set. Essentially i need to delete the entire word which contains the characters "aceae". note that "aceae" is a suffix, but i need to delete the entire word not just the suffix, plus keep the rest of the string. i have tried the "find and replace" function of excel with wildcard, but that deletes everything before/after without deleting the entire word. i have tried a combination of formulas to isolate the unwanted words, but that method is inefficient and inaccurate. below is a schematic of what im looking to do:

Column A ------------------------------ Column B
l. planeri asteraceae africa laselva-----> l. planeri africa laselva
l. planeri moraceae europe singer------> l. planeri europe singer
origin l. fluviatilis bignoniaceae asia----> origin l. fluviatilis asia
alternate l. fluviatilis piperaceae asia---> alternate l. fluviatilis asia

View 6 Replies View Related

Delete Rows Where Columns Have Specific Lower/Upper Case Characters

May 20, 2008

I am trying to detete rows that have several specific values, upper and lower case, (A-H) in any of several columns (B through H). I can delete upper and lower case "D"s in column B, but I'm having difficulty stringing together several variations and getting at the "D"s that are midstream (such as: ADeC), I tried ("*D*") to no avail.

With . Cells(Lrow, "B")
If Not IsError(.Value) Then
'****
If LCase(.Value) = LCase("D") Then .EntireRow.Delete

View 5 Replies View Related

Percentage Occurence Of Specific Word In Range

Apr 29, 2008

I want to count if cells in a specified range =yes then divide the range to get a total percentage of yes cells. I have a data validation list set up with the values: yes, no, n/a. I don't want the total percentage to change when using n/a.

View 9 Replies View Related

Add Character To Value With Less Than 8 Characters?

Jun 17, 2013

I'm trying to find a formula to add a "Y" to the beginning of a value less than 7 characters and and not to add a "Y" to the beginning value that is equal or greater than 8 characters.

This is how I need it to look.
Y123
Y1234
Y12345
Y123456
Y1234567
12345678

View 8 Replies View Related

Formula That Will Remove The First 2 Characters And The Last Character

Mar 10, 2009

i need a formula that will remove the first 2 characters and the last character from the below, so below the result should be R0131644, the number of characters vary from row to row, they are not always 11

EUR01316441

View 9 Replies View Related

Extract Characters To The Left Of Space Character In A Cell

Sep 10, 2013

I can do this in Excel, but I don't seem to have a single example to hand of how, using VBA, to extract all characters up to but not including, the first space character in a cell.

View 9 Replies View Related

Excel 2003 :: How To Remove Characters To The Right Of Last Occurrence Of Special Character

Mar 30, 2011

I have a column of text where I need to remove all the characters to the right of the last occurance of a special character.

I think a process like reading from right to left, look for the first occurance of the special character, and return the characters to the left of this position.

If I can determine the position of the last occurance of the special character, I could use the LEFT function.

The SEARCH function is close. It finds the position of the first occurance of text inside text but it reads from left to right. I need to read from right to left.

Another approach is to examine each character one by one from right to left. If the character is not the special character, delete it. When the character is the special character, delete it and stop the process.

There is no consistency in the text. The total lengths vary. The number of times the special character occurs in the text vary. The number of characters to the right or left of the last special character vary.

I much prefer not to have the solution be some VBA because I need to share it with others who are even less capable than I am. We are using Excel 2003.

View 5 Replies View Related

How To Remove Specific Text Before A Character

May 5, 2014

1) In any cell, I would like to remove "Area#xxxxxxxxx" (where x are random numbers).

Example : "INFO Log - [sys] Area#541185471Character#46545"

2) I would like to remove x characters before a word.

Example : 2013-08-28.txt@INFO

I would need to remove 14 characters before the character "@".

I tried to play with the LEN and RIGHT/LEFT formula but so far, I can't get it to work... The idea is to parse some text and remove the part in red (I was thinking about using SUBSTITUTE).

View 12 Replies View Related

Find Specific Character In A Text?

Jan 23, 2014

I want a formula to find "#" character in a text.

Example

PO# 4343434, MINCDSD.LTD, 977766

Here i I want to find out the character "#" position

I used =FIND("#", A1,1) Answer is 3 it's ok fine.

But I have problem with this below example;

Revised PO#545455, INV# 434344 ABC LTD

In this example i want second "#" position..

View 5 Replies View Related

Returning Value If A Cell Contains Specific Character?

Feb 25, 2014

Essentially what I'm trying to accomplish is import a file from Quickbooks and determine whether it was a Credit Card, Check or Invoice based on the account number.

For example:

45-12345 should return the value CC in an adjacent cell because it contains the "-" character.
I0123456 should return the value INV in an adjacent cell because it contains the "I" character.
01234567 should return the value ACH in an adjacent cell because it doesn't contain either character.

I tried using VLookup, but I can't figure out how to write a formula for when it just contains a character, only if it matches it or is text/number.

View 4 Replies View Related

Search And Replace Specific Character?

Jun 1, 2012

In a cell(s) I have for example {text}dd%2BMore_Text}

what i want to do is search and replace the final }

so it should be {text}dd%2BMore_Text

the regular search and replace in excel removes all } which is not what i need.

View 6 Replies View Related

Replace Specific Character ONLY If Its LAST In The Sheet

Nov 27, 2013

Switched to Excel after using OpenOffice and I'm stuck on knowing what an old a 'find and replace' formula would be in Excel. It would remove a specific character (or word) ONLY if it was the last characters in a cell.

The old find and replace for open office:
Find: (.*)/$
Replace: $1

It's not that important now to delete a word, mainly the last slash '/' ONLY if it's the last character e.g. this data has 2 rows with a '/' as the last character

website.com/page
website.com/page/
website.com/page/page/

Running my old find and replace formula would remove the last slashes, but leave the others

website.com/page
website.com/page
website.com/page/page

Need simple replacement to the find and replace but a formula is also right.

View 2 Replies View Related

Find Specific Character In A Cell

Dec 9, 2009

I am trying to put an IF statement together. If the 7th character from the left is 5 it must show M, and If 0(zero), it must show F

View 2 Replies View Related

Find Cell That Contains Specific Character?

Jul 17, 2012

Cells A1:A5 all have a vlookup formula that will pull one of the following into it:

1. The word "NONE"
2. #N/A error since it doesn't exist in the table
3. A text value that has the format 13.55.46.91

I want a formula that will look at these 5 cells and give me #3. That #3 value can only appear once in the 5 cells in any of those 5. The other 4 cells will contain either 1 or 2.

3 always has length equal to 11. It always has periods in those places. The digits do change.

View 3 Replies View Related

Count Cell Containing A Specific Character

Mar 3, 2008

I have a row of cells that contain a single letter: W,C,O.

I need to provide a count of the number of occurancies of each letter. So I have a cell that shows me the total W's, a cell showing me total C's and another showing total O's.

Whats easiest way to do this?

I know its not ideal, but on this occassion ive no desire to add and hide another column.

View 9 Replies View Related

Selecting Cells Containing Specific Character(s)

Jul 25, 2006

How to get Excel to select all cells within a specific column that contain a specific character. In this instance, I need to select all the cells which contain a comma...

And even better would be if I could get Excel to not just select all the cells in a specific column containing a comma, but each of the rows in which those cells reside.

View 9 Replies View Related

Delete First Character If Blank

Oct 21, 2009

My range is A2:T600 on one single worksheet. In many cells, the first character is a blank space (a mistake of mine when creating the initialize code in the user form into which the info was entered). I only need to do this once ever for this worksheet, but I hate to go through them all by hand. So what I need is to select the range, and IF the first character of a cell is a blank space, delete just that character.

View 3 Replies View Related

Delete String Before Some Character?

Dec 21, 2012

I have some columns in the excel file:

/path1/xyxxx/cccccc/filename12.txt
/path1/bxgdgg/gfdfacc/filenameeee8.txt
/path1/tttwrw/ccefecc/ddddd/filename56.txt

And I would like to delete everything before the LAST slash(just filenames)

filename12.txt
filenameeee8.txt
filename56.txt

View 2 Replies View Related

Function That Inputs A Certain Number Of A Specific Character

Mar 23, 2009

I need to make a list of Part Numbers in quotation marks. If a number of digits of a P/N is less than 13 a number of space characters has to be added to make the string 13 characters long.

We have example P/N:
1234567890123
12345678
123456

should become:
"1234567890123(no extra space characters should be filled-13chars)"
"12345678(5 extra space characters here)"
"123456(7 extra space characters)"

Is there a function that inputs a cerain number of a specific character ("space" in this example)?

View 2 Replies View Related

How To Show Position Of Specific Character In Cell

Mar 9, 2014

How to find and show position number? I try merged two function, but doesn't work

1ΒΊ=FIND("0";B2)
2ΒΊ=FIND(CHAR(1);SUBSTITUTE(B2;"0";CHAR(1);2))
Number
Position

[Code].....

View 5 Replies View Related

Find Specific Character - Copy Into Next Row & Continue

Mar 13, 2008

I have an excel file in which the cell has more than 3000 entries, like following. I would like to copy the contents before ";" to next row & continue.

Question:

CN=123,CN=12,CN=ABC,CN=AB,;CN=345,CN=34,CN=CDF,CN=DC,;CN=510,CN=51,CN=PQR,CN=PQ;

Answer should be in excel:
CN=123,CN=12,CN=ABC,CN=AB
CN=345,CN=34,CN=CDF,CN=DC
CN=510,CN=51,CN=PQR,CN=PQ

I do not know how can I achieve this through "Macro". I would like to detect ; in the cell & copy the contents before/after it in the next rows & continue till the last figure.

View 9 Replies View Related

Using Script To Delete First Character Of Cell

Mar 6, 2014

The script below is used to delete the first character of every cell. I want the commas ',' in the cells starting with a comma to be deleted.

However, it ends up that even for the cells not starting with a comma, the first character is deleted.

[Code] .......

View 2 Replies View Related

Macro To Delete One Character In A Cell

Oct 2, 2007

I'm trying to use Excel 2003 macros for the first time and am very frustrated by it's recorder function. I've used several standalone TSR macro recorders several years ago and they were much easier but certainly not as feature rich.

I have a spreadsheet that I've been using for a couple of years where I have manually entered data. My company has recently started to dump data into an Excel sheet but instead of pure numeric or date values being used they are extracting the values with the ' character starting the value. I want to strip this ' character.

What I do is select the cell I want to edit and invoke the macro. Then press {F2} to edit the contents of the cell, {Home} to move to the left, {Del} to delete the first character - the apostrophe, and {Enter} to complete the edit and move down one cell.

Using the recorder captures the following. Unfortunately it doesn't simply delete the first character, it copies the value of the previous cell to the next cell when I invoke the macro again.

View 10 Replies View Related

Delete Range Name (control Character?)

Dec 6, 2006

I have a defined range in my workbook which I have not been able to delete (I think it got there through some malware because I didn't create it!)

The main annoyance is that the name refers to another workbook (to which I don't have access) and to a non-existent range therein (resulting in a #REF! error) - so I get the unwanted Update Links message each time I open the workbook. I have created my own workbook with the same name as the workbook referred to by the name, hoping that I may gain some level of control over this gremlin, but to no avail.

The name is "Flow" immediately followed by a thin-lined empty square (like the ANSI character 042 formatted using Wingdings2 font). It could be a line-feed character.

Whatever it is, I have not been able to delete this range name - either directly through the Insert / Name / Define / Delete commands or by using VBA. Using the menu commands I can select the name, edit it (even add a valid cell reference to the workbook name), and click Add - but that just adds a new name "Flow" without the control character and the original name remains! The original name also remains if I select the name and click Delete.

View 6 Replies View Related

Delete Row Based On Starting Character 1st Then Contains

Jun 23, 2007

I would like to create a macro that deletes all rows starting with an open parenthensis in column B. The contents of what is in parenthis varies from 2 letters up - so anything starting with a parenthis is sufficient criteria.

After the initial deleting (mentioned above), would also like to delete (from column B again), rows containing specific, multiple phrases.

None of the functions I have see so far will facilitate this...

View 9 Replies View Related

First Character In Cell Is Text Then Delete Row

Aug 16, 2006

In a column I have cells where the first character is numeric and the rest text and also cells where the first character is text.

I want to delete the rows where the first character is text.

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved