Need help splitting or adding carrage return in text string after 550th character uisng VBA or Formula - vba

I've been struggling with this problem for a few days and was hoping i could find some help here.
I have a text file that when I copy into Excel ends up putting the entire text into cell A1 as one long string. These files can be thousands of characters long but each record is always 550 characters. I need to split this text into sections that are 550 characters long so the first 550 characters will go into cell A1 the second 550 characters go into A2 and so on until the text string is done.
I am at a total loss. Everything I've tried on here hasn't worked for me. But i would consider myself a novice at this.
I'm able to grab the first 550 using these formulas:
=LEFT(Sheet1!A1,550) and
=TRIM(LEFT(SUBSTITUTE(A1,"< /a >",REPT(" ",550),2),550))
As you can see this only gives me the first 550 characters.
Ideally I'd like this to be the end result:
A1 First 550 characters
A2 Second 550 characters
A3 Third 550 characters
A4 Forth 550 characters
A5 ECT until the whole string is broken out.
Any help would be greatly appreciated!

To split on every 550th character, with the raw data in A1:
=MID(Sheet1!$A$1,(ROW(1:1)-1)*550+1,550)
Put that in the first cell and copy down

Related

Subscripts in 'user-defined' cell formatting

In libreoffice calc, I use Format cells > Number > User-defined > Format code > 0.000 “kg” to display 200 kg in the cell A1. Now, in cell A2, I can use the formula : A1 x 2 and obtain 400. This is very convenient. Just like this, in the format code 0.000 “CA”, Is it possible to display 'A' as the subscript. Please give your suggestions. Thanks.
Edit: I tried using the unicode. It works well inside the cell. But cannot be used in the format cell dialogue box. The screenshot is attached below. The problems are marked with a red rectangle and a green arrow. Please verify it.
Start typing the format code simply into the cell: 0.000 "C
Now choose Insert-Special Character...
Use this tool to find and select the desired symbol
Complete the cell input
Copy the result and paste it as format code in the Format-Cells... window
This is a general principle for constructing unusual format codes using special characters. Of course, you can simply copy this particular line of format code directly from StackOverflow - 0.000" Cₐ"

Text File Formatting how to add white space in each row using vb.net

How can I add white space in each rows to the exported file. I want to achieve is in each row is it has a total 44 character length. The content + white space to complete the 44 characters in every rows. I have a working code but I don't know how to apply the adding of white space see the last image in the question to give you an idea of what i'm trying to achieve thanks in advance.
CODE
RESULT
RESULT I WANT TO ACHIEVE
In the goal image i have shown the result with white space in every row total of 44 character including white space. How to do that? Thanks in advance
You should give writing the code a crack, but here is a basic outline of what you need to be doing:
count the characters in your string
subtract them from 44
add whitespace equivalent to the result of the previous
Example code:
Dim wsNeeded As Integer = 44 - dgvBilled.Rows(irow).Cells(col).Value.ToString().Length
Dim wsString As String = dgvBilled.Rows(irow).Cells(col).Value.ToString()
wsString.PadRight(wsNeeded," ") ' Maybe just "" instead of " "
Writer.Write(wsString)

excel function or macro delete numbering in front of text

I searched but couldn't find any answer.Need your help tol solve the issues. so here is the problem:
I have a spreadsheet with
Cell A4 : 1.1 ABC
Cell A5: 1.10 BCD 200 ABC
Cell A6: 5.8 ABCD ABCD
So what I want is to delete 1.1 , 1.10 5.8 in front of the text including the space after the number as well.
I tried right function but didn't solved the issue.
Transformed Cell A4:ABC
Transformed Cell A5:BCD 200 ABC
Transformed Cell A6:ABCD ABCD
It should check all the A colomn till A100 for example
It should work if you formulate it this way:
=RIGHT(TRIM(A1),LEN(TRIM(A1))-FIND(" ",TRIM(A1)))
By trimming, you're making sure you get rid of trailing spaces before dealing with the real problem (taking only what's to the right of the first remaining space)
Sometimes even if your language is set to English, your localization may be different from other users'. Changing all , into ; may often time solve the "We found a problem with this formula" error message. In this case, this formula is compatible with #ahmet 's setup.
=RIGHT(TRIM(A1);LEN(TRIM(A1))-FIND(" ";TRIM(A1)))
Try this if you want to display Error when there's an error with the formula. Replace "Error" with "" if you want the cell to remain empty if there is an error.
=IFERROR(RIGHT(TRIM(A1);LEN(TRIM(A1))-FIND(" ";TRIM(A1))); "Error")
Try this:
=RIGHT(A1, LEN(A1) - FIND(" ",A1,1))

VBA: Copy number from a string of text and insert into cells below

I want to create a makro in Excel which performs - after pressing a button - the below. I attached some dummy data that is formatted like the actual sheet.
There are several data blocks that are seperated by headlines in Sheet 1. From these headlines, I want to get a string of numbers and put it into column S for each line with data below that heading. In line 6 the heading says "2000", thus lines 8-19 should have a "2000" in column S and so on. The number I want to get is always after the word "Monthlyaccount" but the lenght of the number can be different - from 1 to 7 digits.
For lines where no data is given (data lines might be recognized by looking if in A is a valid date given) there should just be "ERR" instead of the number.
Can anyone help out?
Thanks so much upfront!
Say the string (in cell A1) contains "Monthlyaccount" followed by a blank followed by a number followed by another blank. To extract the number, use:
=--LEFT(MID(A1,FIND("Monthlyaccount",A1)+15,9999),-1+FIND(" ",MID(A1,FIND("Monthlyaccount",A1)+15,9999)))
This does as requested. Paste the following into S3 and drag down
=IF(AND(ISNUMBER(RIGHT(A2,4)*1),ISNUMBER(RIGHT(A3,4)*1)),S2,IF(ISNUMBER(RIGHT(A3,4)*1),LEFT(RIGHT(A1,LEN(A1)-FIND("Monthlyaccount",A1)-14),FIND(" ",RIGHT(A1,LEN(A1)-FIND("Monthlyaccount",A1)-14))),"ERR"))

Linking cells in excel with a specific format

I am trying to link cells in excel on two different work sheets.
I am using the formula eg: cell1 = cell2 + cell3. The numbers that I have in cell2 and cell3 are in format of 100% (1) and 50% (2). I just want to add numbers 1 and 2 so that my cell1 will have number 3.
Is it possible to do without changing the cell formats?
Thanks a lot.
If you don't care about the percentages, just copy your column with the percentages and change the format of that column to value and in sheet 2, do addition on that column instead.
Unfortunately when a cell has a format of percentage and a user enters a number, it is converted into what it means given the context of the format. It's not like what is being displayed is wildly different than what is 'hidden' inside the cell. When you reformat a cell, that data is reformatted as well, so 50% becomes .5 even if you had originally entered 50 in the cell before changing it's format. Format is more than just 'display format' so maybe that's where the confusion is.
If you want to add the cells in the percentage row and not bother with reformatting the formula cell you can cheat and treat it as a string to get rid of that %. You could do =Left(A2+A3, Len(A2+A3)) that will give you the 1.5 answer without having to format te cell.
Not sure i understood your question but i'll give some elements:
formula and formats are separated in Excel, thus, you can set a formula in A1, say =A2+A3 but displays the value the way you wish
for instance, if A2 contains 100% and A3 contains 50%, then the result in A1 is worth 1.5
you can set the format of A1 the way you wish (Right-clic > Format cells > Number tab), for instance, decimal, the cell will then display 1.5 but if you choose percentage, the cell will then display 150%
Please elaborate your question if needed.
[EDIT] New answer thanks to your comment:
If i understand well, you want to sum up the values between brackets in your cell (whatever is before, event percentages in your case).
Then, you can try this in cell A3:
=MID(A1,FIND("(",A1)+1,FIND(")",A1)-FIND("(",A1)-1 )+MID(A2,FIND("(",A2)+1,FIND(")",A2)-FIND("(",A2)-1 )