I need to add .jpg at the end of all he cells in one or more columns
9788895249971 into > 9788895249971.jpg
9788867230129 into > 9788867230129.jpg
9788867230273 into > 9788867230273.jpg
9788867230280 into > 9788867230280.jpg
Detailed step-by-step instructions are much appreciated since I am very new to Calc.
Thanks
Do you need to do this once or is this going to be a repeated task every week/month?
If it is something you need to do just once, here is what you can do:
Next (right) to the column where your numbers are open (insert) a new column.
Assuming the following: Numbers are in column A, New column is column B.
In this new column B in the top cell (B1) write:
=A1&".jpg"
Now copy B1 all the way down to the end. In B1 type [Ctrl]+c then Hold [Shift] and hit [PgDn] until the end then press [Ctrl]+v.
Highlight Column B, [Ctrl]+c, then [Edit] [Paste Special] values only (No formula's) this freezes the calculated data.
This is just another option,
just click the function wizard and select concatenate, in that enter which column you want to enter as text1 as and second column in text2. Then when you click OK you will get an concatenated column like below image
so in the C column you will get as a1.jpg.
For those who continue to find this question (as I did):
This can be quickly done using regular expression option of find and replace. (I don't know what version of Calc introduced regex searches, but 6.2.4 has it.)
If you only want to update some non-blank cells on the sheet, select them.
Choose Find and Replace.
On the dialog, fill in the following:
Enter $ for the Find value. ($ means end of line in regex, or in this context end of cell value.)
Enter the desired suffix (.jpg in the question) for the Replace value.
Check Regular Expressions under Other Options
Check Current Selection Only under Other Options if you want to limit to the cells selected in step 1.
Uncheck All Sheets unless that is what you want.
Choose Replace All
This will update the values in-place and does not require any additional columns or formulas.
There's a much more elegant way to do this that doesn't require sacrificing cells just to hold data types, and can be scaled to work with one cell or a large chart range.
Add both pieces of data into the =CONCAT() function
Make sure to use CONCAT instead of CONCATENATE, as `CONCAT accepts cell ranges and is more dynamic.
Open the Function Wizard on the cell in question, and build the following function:
=CONCAT(<your_data>," <suffix>",...)
# Make sure to add a space before the suffix so it appears in the cell.
# You can use this with as many input variables as required letting
# you add as many strings, formulas, or numbers together.
The result should be something like this. In my example, the cell in question is the final value of Ethereum on a balance sheet:
The above example was an easy one, since it was being used as a test, all my summed values were ints, if I had floating point numbers, they would run away to max decimal places (not very pretty).
The function will drag out and expand intelligently to other cells like any other formula.
Adjusting accuracy of floating point values inside a CONCAT function
Sometimes, adding a cell results in a rounding problem, or an extreme amount of decimal places. You can further nest your function using ROUND(<your_data>,<decimal_places>)
Your function would look like this:
=CONCAT(ROUND(<cell_range>, ".jpg")
In your specific case, you don't need a space in the second argument as you want to append .jpg directly to the end of the string.
`
Using Macros to automate the entire process
This is extremely repeatable, and using the Macros feature, you can automate these to make much more simplified functions that allow you to enter just the variables you need, while the macro does the work in the background.
Based on Emmanuel Angelo R.’s answer, I would advice learning to differentiate between fixed cell references and dynamic ones. The following applies:
Cell A1 contains the suffix you would like to add, e.g. ‘.jpg’
Row 2 contains headings, e.g. B2 = ‘Old Filename’ and ‘New Filename’
Cells A3:A¹ contain your filenames
Cells B3:B contain you concatenation formula
In cell B3, type =concatenate(A3;$a$1).² If your locale requires comma as separator, replace my semicolons with commas. Copy cell B3 by selecting it and pressing Ctrl + C. Move the cursor to cell A3, press Ctrl + ↓ (down arror on your cursor keys); this will move you to the bottom of the list of file names. Move your cursor right, then press Ctrl + Shift + ↑; this will select all cells up to the last cell with contents (the one you just wrote your formula in). Press Ctrl + V to paste your contents.
Adding dollar signs in front of your row/column coordinates, will lock that coordinate when pasted. Say you had a list of file types in cells b1–z1 (e.g. jpg, jpeg, tga, bmp, png et c.). An easy way to create the formula would then be by first typing it in cell B3 as =concatenate(A3;B$1), then paste it to every cell till the end of your file names list (cell z3); these cells would then read …A3;b$1, …A3;C$1 et c. When copying it for all the rows below
You could select the entire range of cells with formulas in row 3 and run a search and replace, replacing all instances of ‘A3;’ by ‘A3;$’, effectively inserting a dollar in front of all the cell references, allowing you to, should the need arise, copy it horizontally as well as vertically (the latter being covered by the $ in front of 1).
¹ This means cells from A3 and however far down your sheet goes
² Strictly speaking, it is only necessary to type it as a$1.
Related
I have a text file.
There are hundreds of different filenames in the text file.
However, it says different date and time at the end of each file.
Sample: life-in-cosmos-2021-11-11-12-45-46 or life-in-cosmos-2021-11-11-12-45.
In order to change the names of the files in bulk, I first need to delete the dates in this text file.
So I want to automatically delete the dates and times in each row.
However, I don't know anything about this.
And I don't know how to use macros.
Therefore, if there is a solution for this, can you provide an answer with a picture or video?
In order to explain my request more clearly, I present 2 examples.
Example:
Original Text: cosmos-lights-colors-T5DAPC-2020-09-11
The result I want to do: cosmos-lights-colors-T5DAPC
Example 2:
Original Text: cosmos-lights-colors-T5DAPC-2021-04-02-12-37-49-utc
The result I want to do: cosmos-lights-colors-T5DAPC
Assuming a date is always at end of each line, you can replace a regular expression with an empty string. To do this:
Press Ctrl+H to bring up the Replace dialog box, and set following options:
Find: -[0-9]{4}-[0-9]{2}-[0-9]{2}[0-9\-]*?(\-utc){0,1}$
Replace with: (blank)
Set the Regular Expressions option
First, click the Find Next button to highlight matches to make sure they are correct. If the matches are incorrect, you will need to adjust the regular expression.
Finally, click the Replace All button to remove all matched strings.
Before replace
cosmos-lights-colors-T5DAPC-2020-09-11
cosmos-lights-colors-T5DAPC-2021-04-02-12-37-49-utc
After replace
cosmos-lights-colors-T5DAPC
cosmos-lights-colors-T5DAPC
I have cells in a few rows that all reference one row on another sheet:
=Sheet2.A1
=Sheet2.B1
=Sheet2.C1
When I select these cells and drag the fill handle to fill the cells below, Calc fills them like this:
=Sheet2.A4
=Sheet2.B4
=Sheet2.C4
=Sheet2.A7
=Sheet2.B7
=Sheet2.C7
etc.
I guess it's doing this because each new row is three cells below the original row.
This is not the behaviour I want - I want to fill them in a series, like this:
=Sheet2.A2
=Sheet2.B2
=Sheet2.C2
=Sheet2.A3
=Sheet2.B3
=Sheet2.C3
=Sheet2.A4
=Sheet2.B4
=Sheet2.C4
etc.
Any ideas how to do this?
I'd like to use either a formula or a manual way of doing this - I'm not familiar with macros so would rather avoid if possible, please.
Manual way (I like that suggestion, I never even thought about using Calc to automatize the process of filling in spreadsheet formulas before, but it's doable):
Open a new Calc file
Format cell A1 as text
type =Sheet2. into A1 (A1 should now display =Sheet2. literally)
type A B C into B1, B2 and B3 respectively
select B1 to B3 and drag down (it should repeat series A,B,C,A,B,C...)
type =FLOOR((ROW()-1)/3)+2 into C1 (ROW() starts counting from 1 hence the -1)
drag that down (it should give you the series 2,2,2,3,3,3,4,4,4...)
type =A$1&B1&C1 into D1 (D1 should now display =Sheet2.A2 literally)
drag D1 down and it should give you your desired series
NOW: copy that
paste it into any notepad or similar plain text editor
copy that
paste it into the Calc spreadsheet you wanted to have this series of references in first place
it should open a text import dialogue - just make sure everything is pasted into one column and hit OK
Voilà
pros: when your colleagues see you do that you will be seen as LibreOffice god from now on
cons: not very dynamic (you'll have to repeat the whole process if something changes)
Formula way:
Use OFFSET.
E.g: =OFFSET(Sheet2.$A$2;FLOOR((ROW()-1)/3);MOD(ROW()-1;3))
pros: easier to modify
cons: if the results are not what you're expecting, it's harder to debug
Is there a possibility or formula, to extract all cell data from different columns then putting them under each other just on one column, each cell data just in one cell, therewith I can sort them e.g. from A to Z in one column.
Thanks in advance
Solution 1
Using helper column.
In Cell E2 enter the following formula
=INDEX($A$2:$C$15,MOD(ROW()-ROW($G$2),ROWS($A$2:$A$15))+1,TRUNC((ROW()-ROW($G$2))/ROWS($A$2:$A$15))+1)
Drag/Copy down as required.
Then in Cell F2 enter
=IFERROR(INDEX($E$1:$E$45,SMALL(IF($E$1:$E$45<>0,ROW($E$1:$E$45)),ROW(F1)+1)),"")
This is an array formula so commit by pressing Ctrl+Shift+Enter. Drag/Copy down as required. Change range as required.
See image for reference.
Solution 2
Using ugly looking long formula.
Enter the following formula in Cell D2
=IFERROR(INDEX($A$2:$A$15, SMALL(IF(ISBLANK($A$2:$A$15), "", ROW($A$2:$A$15)-MIN(ROW($A$2:$A$15))+1), ROW(A1))), IFERROR(INDEX($B$2:$B$15, SMALL(IF(ISBLANK($B$2:$B$15), "", ROW($B$2:$B$15)-MIN(ROW($B$2:$B$15))+1), ROW(A1)-SUMPRODUCT(--NOT((ISBLANK($A$2:$A$15)))))), IFERROR(INDEX($C$2:$C$15, SMALL(IF(ISBLANK($C$2:$C$15), "", ROW($C$2:$C$15)-MIN(ROW($C$2:$C$15))+1), ROW(A1)-SUMPRODUCT(--NOT((ISBLANK($A$2:$B$15)))))), "")))
Drag/Copy down as required. Change range as per you data.
Note : This formula will work only for three or less columns.
An easier way without using any formula. Just go to Find & Select, go to special, select blanks. All the blanks are now selected go to
I'm merging columns in Libre Office using the CONCATENATE function.
I'm merging all text using:
CONCATENATE(A1," ",B1," ",C1," ",D1," ",E1," ",F1," ",G1)
According to this suggestion, I should be able to apply the function over the whole column by dragging the plus sign; however, when I drag the plus sign, it only copies the first line, but I want to merge the next row.
How can I merge the columns correctly?
#oczdref, I am not sure why this would not work in your situation. Here is what I did (please ignore the ; separators, in your case they should remain ,)
I also found out that you must enable the "AutoCalculate" under Tools -> Cell contents
so that when you drag the autocomplete function instead of getting the result
something like this:
and the result that i want to.
I have a table in org-mode with emails in one column. I want to collect all the emails as a comma-separated list, but I don't know an easy way to do it. It seems like something fairly simple, but I can't find a solution anywhere on the web.
What would be the simplest way to do it?
Dipping my toes slightly into org mode, a very simple formula of #1.. will do the trick of making a list from the values in the current column from rows 1 onwards, as it simply joins the values by commas by default. e.g.:
#+TBLFM: #5$2=#1..
(followed by C-cC-c to evaluate), would create a list in row 5, column 2, of all the values in column 2.
It does wrap the list in square brackets, but that's obviously no problem for a manual approach.
One manual approach would be to use rectangle editing commands to extract the content of that column (which should be nicely aligned by org-mode), and then just search and replace to convert to CSV format:
C-SPC at first corner
C-xrk at opposite corner
C-/ to undo the kill (there's no default copy-rectangle command)
Then in the buffer where you want the list of addresses:
C-xry to yank the rectangle
C-xC-x to exchange point and mark, marking the region
C-M-% to regex search and replace within the region, like so:
C-M-%SPC*C-qC-jRET,RET!
Does M-x org-table-export do what you want?