ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   deleting the last nine characters in a cell (https://www.excelbanter.com/excel-programming/301826-deleting-last-nine-characters-cell.html)

Chris

deleting the last nine characters in a cell
 
Ok, I have three cells. In the first one (A2) there is an item and dollar amount:

XXXXXXXXXXXXXX ($10.00)

In the second (B2) is a number:

1

The third (C2) is set up to populate if cell 2 has a number one in it with the following formula:

=IF(LEFT(B2)="1",(IF(Left(A2,29)="XXXXXXXXX","XXXX XXXXX","")),"")

This way it will see that there are ten Xs and then anything else and populate ten Xs in the cell.

I need the formula of a vb code that will populate cell three (C2) with the information in cell one (A2) minus the last nine characters (" (10.00)").

TIA
-Chris

Tom Ogilvy

deleting the last nine characters in a cell
 
if you don't care to check anything

Sub MakeC2()
Range("C2").Value = Left(Range("A2").Value,len(Range("A2").Value) - 9)
End Sub

--
Regards,
Tom Ogilvy


"Chris" wrote in message
...
Ok, I have three cells. In the first one (A2) there is an item and dollar

amount:

XXXXXXXXXXXXXX ($10.00)

In the second (B2) is a number:

1

The third (C2) is set up to populate if cell 2 has a number one in it with

the following formula:

=IF(LEFT(B2)="1",(IF(Left(A2,29)="XXXXXXXXX","XXXX XXXXX","")),"")

This way it will see that there are ten Xs and then anything else and

populate ten Xs in the cell.

I need the formula of a vb code that will populate cell three (C2) with

the information in cell one (A2) minus the last nine characters ("
(10.00)").

TIA
-Chris




Twoo Doggs

deleting the last nine characters in a cell
 
Use the Excel Help menu and Search for Find. The Help menu has some examples of using the Find function which needs to be incorporated into your IF() function.

--
Paul M


"Chris" wrote:

Ok, I have three cells. In the first one (A2) there is an item and dollar amount:

XXXXXXXXXXXXXX ($10.00)

In the second (B2) is a number:

1

The third (C2) is set up to populate if cell 2 has a number one in it with the following formula:

=IF(LEFT(B2)="1",(IF(Left(A2,29)="XXXXXXXXX","XXXX XXXXX","")),"")

This way it will see that there are ten Xs and then anything else and populate ten Xs in the cell.

I need the formula of a vb code that will populate cell three (C2) with the information in cell one (A2) minus the last nine characters (" (10.00)").

TIA
-Chris



All times are GMT +1. The time now is 07:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com