My cells have up to 14 spaces
If a cell as 1 or 2 characters -I want to add 6 spaces in front of text.
If a cell as 3 or 4 characters-I want to add 5 spaces in front of text.
If a cell as 5 or 6 characters-I want to add 4 spaces in front of text.
If a cell as 7 or 8 characters-I want to add 3 spaces in front of text.
If a cell as 9 or 10 characters-I want to add 2 spaces in front of text.
If a cell as 11 or 12 characters-I want to add 1 spaces in front of text.
I'm compiling several old worksheets into a single database for a research study. The worksheets contain patient data. Some of the worksheets have the patient's last name, first name, and middle initial entered all in one cell like this: Smith,John R. Compounding the problem is the fact that sometimes the name is entered with a space between the comma and the first name, sometimes not.
I have formulas to break the name out into three separate columns "lName, "fName", "midInit". However, if the name in the original cell has a space between the coma and the first name, then the “fname” column will contain a blank space in front of the name. This is problem because patients names can appear in the database more than once. Some patients are in the database several times.
If patient “John R. Smith”, for example, is entered in the database as”
“Smith” “John” “R “
and also as
“Smith” “<space>John” “R”
then the database won’t recognize them as the same name when I search for John Smith’s data. Right?
If so, then I need a way to eliminate the empty spaces in front of the first names. Like I said, some have empty spaces and some don’t. I could do this by hand, but there are over 1000 entries in these worksheets.
I am trying to get rid of the spaces at the beginning of text that is the result of a download from a reporting software package. I am using the Trim function but it does not work. It seems that it has something to do with the formatting. The first set of data of the download looks as follows: SalesSales BreakdownSolenaceousCucurbitsLargeSeedIf I overtype the text in exactly the same way (thus keeping the spaces at the beginning), the trim function works. But this is not a practical solution.
The type of the cells is "2". I have tried copying the data as values to a different workbook but this does not help either.
I have a very long list of international phone numbers in a .csv format that I need to put a zero in front of each one. We are doing an international autodialer campaign for an upcoming event and need the zeros at the beginning to pay for the call. How do you get around Excel not allowing a zero at the front of a number and the .csv format not allowing you to save certain formats? I've been searching the archived posts for a hour now and can't find anything on this!
I have a table of postcodes and I need to import them into a bespoke application. The aaplication requires them to have extra spaces depending on the postcode i.e.
BS35 2JW - this is fine because it has the maximum amount of characters 8
I have a column which contains a series of alphanumeric characters some start with the alpha characters and others end with them.
As an example ABS1234, 1234ABS, 12k34AB needs to be ABS1234, ABS1234, AB12k34. The number of alpha characters at the end will be a minimum of 2 and a maximum of 3. Is there some way that I can move the Alpha characters, at the end, so that they are always at the beginning of the string?
I have a simple code that should insert the text at the beginning of the text file (the text file already has some text in it). When i use the following code, it just appends the line to the end of the text. I need it to append it to the start of the text file.
Code:
Private Sub CommandButton1_Click() Dim file As String lastrow = Range("D65536").End(xlUp).Row - 4 file = "C:Users11126923Desktop est.txt" Open file For Append As #1 f = "hi test3" Print #1, f Close End Sub
I have two columns D and E that contain dates and values. Column D has the dates and Column E contains the corresponding values.
I need a macro to take all of the dates in column D (it is pulled from a different macro so the length of the two columns varies every time but starts at D2) and paste the first value in W1, the second value in AE1 , and so on (every eight cells).
I need to do the exact same thing with Column E except start at Y1, then AG1, etc (still every eight cells).
Having difficulty with a VLOOKUP that uses a text lookup field beginning with 0. For all the other numbers formatted as text I use this function:
[Code].....
For the one that begins with a 0 I have to use this function:
[Code] .....
This is a problem for me, because I need to be able to copy the top function to all of my sheets without having to edit the ones where the lookup field begins with 0. I could alter my VBA to specifically search for those cases and adjust, but that seems unneccesary.
More info - The beginning column of the Table Array (i.e. the lookup field I'm searching for) is a function of another cell; both cells are formatted as text. Here is the function:
[Code] ....
I have to put a single quote in front of the lookup field, so that "064" is not displayed as "64" even if the cell is formatted as text. I have another instance where I am looking up "'791" and it works fine with the first VLOOKUP above. Even if I remove the single quote this will work. However, once there is a leading zero the function no longer works and I must use the second VLOOKUP listed above.
Some code below which I have inherited, basically its looping through one column of data and removing the text at the beginning before the hyphen eg. '123 - data text' to 'data text'.
HTML Code: 'Remove everything before the hyphen in the activity column Dim SearchStr Dim CharOffset As Variant Range("c7").Select
I have rows with "numbers" like 1 250,30 and 1 350,50, but they aren't in number format (I guess this is the problem). I am trying to get rid of the extra space between the "numbers" but the substitute or trim function does not work for me. I also tried to divide and multiply the numbers but it does not work.
I want to get the extra space of and to the number format.
I have a large spreadsheet that I need to take the spaces out within the text in each cell. Is there an excel function or macro that can do this? It would save me lots of time rather then having to go in manually and doing it!
I am trying to get spaces in text from several cells
A5 GH B1 YO E3 AF < I linked these cells with the & =A5&GH&B1 and it comes out like this GHYOAF
I would like it to come out like this : (either with or without the / or underscore in leu of a space)
Additioinally if I use the CONCATATE function it just showes the cells like this A5B1E3 ? Dont understand why its not showing the data rather the cell names & Numbers ?
I'm trying to use the SUBSTITUTE function to remove spaces from my cells in column A. The trouble is My formula is removing all the spaces from the cell. My formula is: SUBSTITUTE(A1," ","")
I do however have many cells that contain a space between characters 5 and 7 and spaces at the end of the cell which have been padded out to 15 characters long.Its only the spaces at the end of the cells I need to remove.
I have a formula that is dependent upon a column of cells containing text. Cells within this column randomly have an additional space (" ") following the words. With this invisible space, the formula doesn't work as intended.
Since I have an extremely long list of names, is there a way to easily remove additional spaces after words without manually going through each cell and deleting them?
Column A have data and i need VB Code (Not formula) to check each cell in column A and delete any spaces and make sure that there is no spaces after end of the text.
As an example you can see Cell cell A15 thru A22 have spaces after the text so need to delete those spaces
I need to take 12ABC1234512345 and turn it into 12A BC 12345 12345 with a vba macro. I've made a formula that works but in this situation a macro would be more ideal.
I am looking for this for some time. Is there any formula (not vba) to count that how many occurances of spaces are in a text string, spaces could be more than one between the words.
I need help looking at text in a cell that has [] around it such as [big red trucks] and copy that text to the end of the cell and replace the "space' between the words and add '+' signs so the result looks like [big red trucks] [big+red+trucks].
example:
This is what the cell looks like before
[big red trucks] cost 5000 in store
This is what the cell needs to look like after
[big red trucks] cost 5000 in store[big+reg+trucks]
there may be additional text after the ']', I need the phrase with the + signs copied to the end of the cell
I've got a single column worksheet with a varying numbers of characters in each row.
At the end of each row's cell value I must add a 5 char string. Preceding that string I must have enough spaces to make the total length of each row 106 characters.
I've already:Defined and populated the string. Let's call it "strMyString".Established how many rows are in the sheet and stored it in "lngUsedRange"Written the following which cycles through each row establishing how many spaces need to be added:
Dim lngSpacesNeeded As Long
For i = 1 To lngUsedRange lngSpacesNeeded = 101 - Len(Range("A" & i)) Next i
Now I just need to know what else to put before "Next i" to locate the end of the existing text in the cell and add the number of spaces in "lngSpacesNeeded" then add "strMyString".
Initially I'm simply copying a data table from a web page using "Ctrl + A" then "Ctrl + C", and then pasting the data straight onto a new worksheet so I can work with it. (After temporarily re-naming the old sheet)
But I keep finding what looks like double-spaces after some of the important text within the Range of cells I'm working with. I need to be able to select & conditional format the values of the text in some columns of the sheet, so need to loose these trailing spaces.
Unfortunately, it's not consistence as to how many spaces trail the text I need. Sometimes it's only one space, sometimes its two spaces ?
So far, I've had mixed success with a recorded "Replace" code but none of the other codes I have found on forum pages either don't work all or seem to give any consistent results. E;g; TRIM, CLEAN
I suspect my problem is, I do not know how to call the code properly, or trying to work with too large a range ?
I'm outputting some cells to a CSV. At first I tried using the SaveAs function but that renamed my worksheet and didn't work for ranges (as far as I know)
Sub Export() 'Set myADPFile = "C:ADPPCPWADPDATAPRSHWEPI.CSV" Dim myADPFile As String myADPFile = "C:PRSHWEPI.CSV" Dim x As Byte x = 5 Open myADPFile For Output As 1 While (Not (Sheet3.Range("A" & x).Value = NA)) Print #1, Trim(Sheet3.Range("B" & x).Value), ",", _ Trim(Sheet3.Range("C" & x).Value), ",", _ Sheet3.Range("D" & x).Value, ",", _ ..........................
The values are correct. However, the excess amount of spaces is not. Using the Write function just encases everything in quotation marks. Replacing spaces isn't a good solution because the first row MUST be in that format, and removing all spaces would require more code to put spaces back in. Is there a way to get rid of all the excess spaces surrounding each value?
is there a formula which can locate instances of same text even though due to spaces it may look different? for example, "bad apple" and "badapple" are essentially the same.
is there a way to reduce spaces between text stings to one space only when there are many spaces? To make it worse, the number of spaces between the text strings vary. I am using Excel 2010.