4

I want to delete a set of characters which are behind a backslash in LibreOffice Calc. For example:

My/Name
Is/Jeff

where I would like to delete My and Is such that only /Name and /Jeff remain.

Does Libre's inbuilt functionality allow something like this or will I need to write some sort of script?

Community
  • 1
  • 1
Rushat Rai
  • 743
  • 2
  • 15
  • 31

2 Answers2

5

Use this formula:

=RIGHT(A1, LEN(A1) - FIND("/", A1))

Breakdown:

  • RIGHT(A1): take the righthand side of the string in A1
  • LEN(A1): count the number of characters in A1
  • FIND("/", A1): get the position of slash in A1

In other words, count all the characters and subtract the position of the slash. That's how many characters we grab starting from the right-hand side.

Jim K
  • 12,824
  • 2
  • 22
  • 51
  • Very concise and helpful :). I was wondering if you could assist me with another problem I was having, if it's not too much trouble. I want to add a space and a certain number after certain cells. For example cell a1 has these contents "applesauce/101.jpg" and cell B1 has these contents "bacon/101.jpg". I want them to become like this: "applesauce/101.jpg 0" and "bacon/101.jpg 1". Is this possible using formulas? Thanks! – Rushat Rai Jun 24 '17 at 06:32
  • This should be a separate question, which I see you've already made [here](https://stackoverflow.com/questions/44733614/is-there-formula-which-enables-me-to-add-a-space-and-a-number-after-certain-cell) -- good job. :) – Jim K Jun 24 '17 at 15:29
2

Libreoffice/Openoffice Calc Find&Replace is able using regular expressions.

So you can search for ^.*\/ = from start of line, all kinds of characters until last occurrence of slash...

and replace that with nothing:

enter image description here

Or if only till first occuring of slash and if the slash shall be remaining, then you can search for ^[^\\\/]* = from start of line, all kinds of characters except slash...

and replace that with nothing:

enter image description here

Axel Richter
  • 56,077
  • 6
  • 60
  • 87