How to rearrange text files into columns? - text

I want to rearrange a text two text blocks into columns.
Consider the following example
line a1
line a2
line a3 space
line a4
line b1
line b2
line b3
line b4
I would like to turn it into
# Col1 #Col2
line a1 line b1
line a2 line b2
line a3 space line b3
line a4 line b4
I have looked into the column command which would require the lines to be in one line with a appropriate separator such as line a1 & line b1. Then I could just run column -s"&" -t (in vim).
Is there a more elegant way to do this? My preferred editor is vim so a solution based on vim would be great.

ctrl-v enter column mode, select the first block press d
same as ctrl-v select the 1st column in 2nd block, then press I<space><space><Esc>
press shift-p to paste the 1st block in place
press ggd) to remove the empty lines
It works like:

Related

Show icon on next empty line in Excel

I'd like to show an arrow icon beside the next line for data entry in a tracker I'm working on. In this example, if row 6 is the next line to add information (text) in cells C6 to H6, show an arrow in B6. Once there is text in C6, B6 should be blank and an arrow show in B7 (B8 through would also be blank at this point). This is what I have in B6 but the arrow remains even after entering text in C6 and the subsequent B cells with this formula also have arrows:
=IF(AND(C5<>"",C7<>""),"","▶")
I'd like an arrow only in one B cell at a time, please :)
Test the one above and the one beside:
=IF(AND(C1<>"",C2=""),"▶","")

Search option with specific text words with multiple inputs [=IF(ISNUMBER(SEARCH("apple",A1)),"Y"," ")]

Search option with specific text words with multiple inputs
Column A contains text trying to search a specific test in a cell prints output Y/N
A1 cell contain text apple applying formula in B1 =IF(ISNUMBER(SEARCH("apple",A1)),"Y"," ") output prints "Y" as expected.
A2 Cell contain text [apples][3] applying the same formula in B2 =IF(ISNUMBER(SEARCH("apple",A2)),"Y"," ")output still shows "Y" How to get it printed as "N"
A3 Cell contain text apple,apples applying the same formula in B3 =IF(ISNUMBER(SEARCH("apple",A3)),"Y"," ") output prints "Y" as expected.
A4 cell contain text apples,apple applying the same formula in B4 =IF(ISNUMBER(SEARCH("apple",A4)),"Y"," ")output prints "Y" as expected.
Now the query is how to get printed as "N" or Blank if "apple" is not exist in cell.
If your words are always separated by a comma as shown in your provided sample data, this should work for you to find an exact match. Put in cell B1 and copy down:
=IF(ISNUMBER(SEARCH(",apple,",","&A1&",")),"Y","N")

Fill blank value in Excel

Need help in Excel for the following problem
ColA ColB
A1 B1
A2 B2
A3 B3
A4
A5 B5
A6 A6
A6
A6
if Column B is blank, I need to copy the value of ColA into ColB. But if the value is already present, then no action is needed.
Is it with formula or Vba?
A formula like should be ok (you copy/paste this formula to every cells in your Col)
=IF(B1="",A1,B1)
In column C enter the following formula:
=IF(B1="", A1, B1)
Copy this formula down column C. Then, assuming it looks right, you may delete the current column B, leaving the new column to become the new column B.
It is important to note that this formula won't work if directly entered into column B. In that case, Excel would complain about a circular reference.
Highlight the entire column B used range and press Ctrl+F to open find and replace then insert select
find " " (leave blank)
replace =OFFSET(INDIRECT(ADDRESS(ROW(), COLUMN())),,-1,1)
Which looks like:
Result:
This, INDIRECT(ADDRESS(ROW(), COLUMN()), refers to the cell itelf, and -1 column offset argument refers to column to left.
You can then do copy paste as values to convert formulas to hard coded values.

Excel Reference Cells Up to Number of Characters Until Last Space

I have a cell that is referencing multiple different cells and I want it to reference one more cell at the end that will fill the rest of the space up (up to 80 characters).
Example: Cell AA2 (cell I want to fill up) contains: =B2&" OEM "&D2&" replacement "&LOWER(LEFT(TRIM(X2),FIND("~",SUBSTITUTE(X2," ","~",LEN(TRIM(X2))-LEN(SUBSTITUTE(TRIM(X2)," ",""))))-1))&" "&LOWER(T2)
Cell Z2 contains: 582146-01 BDEMS600 MS500CBGB MS525B MS800B
I want to add the contents of Z2 to the end of AA2 but only until AA2 has 80 characters and I don't want just part of one of the items in Z2. Another thing is I want to do this starting from the end of cell Z2 so let's say 582146-01 and BDEMS600 might get cut off to make it 80 characters. Is this possible? Thanks for the hlep!

Inserting values in libreoffice / excel without using autofill

I have a libreoffice sheet that I would like to have the rows increase by 1
example:
1
2
3
4
The problem is I know I can do this with autofill but I have 50000 rows and dragging down takes awhile.
Thanks
Assuming that you already have data up to row 50'000, and you have an empty column (I'll use Col. A) for the series.
Jump to the last cell in one of the "used" columns Ctrl + Arrow down (or scroll all the way down to Cell A50000) then move sideways to Col. A and place an "X" in cell A50000. You now have an empty column A, with an "X" in cell A50000.
Go to cell A1 ( Ctrl + Home ). Put the number "1" in cell A1. Put the following (secret!) formula in cell A2:
=A1+1
Copy cell A2 with Ctrl+c
Stay in Cell A2...
Press Ctrl+Shift+Arrow down, The area from A2 to A50000 should now be highlighted.
Press Ctrl+v to paste the formula all the way down...
IMPORTANT!
Press Ctrl+c to copy the just pasted data (A2..A50000).
Press Ctrl+Shift+v to paste the just copied data "over" the original data with "paste special".
In "Paste Special" make sure that you have NOT selected the option: Formulas.
This will now paste all the results of the formulas back as fixed numbers.
This should take less than a minute, of which most of it is waiting for the system to calculate and to paste (I tried it for 1 mio lines..)
By just changing the formula from =A1+1 to =A1+2, jou can jump with 2, so 1,3,5,7,... But I assume that you'll use this column as a reference for sorting, so you can always go back to the original order.
Have fun!

Resources