Make row number of cell in Libreoffice a variable - openoffice-calc

When I'am going to join two columns in the Libreoffice Calc, it seems that I have to do this by programming in Python for as far as I know, there is no way to index a cell by variable, specifically, to use a variable to denote the row number or column number.
I wonder whether there is no way to do this?
Many thanks if you could save me from write another temporary python script >_<

I feel you may need the INDIRECT function.
You can try with
="Good Morning Mr, " &INDIRECT("D" & A9)
which will give you
"Good morning, Mr White"
where D9 contains string "White", and A9 contains digit 9
Hope will help

Related

Command with KEYPOS and SEP like sort, but for removing or moving instead of sorting?

Example:
1;Cristiano Ronaldo;Portugal;88;121;0.73;'03-;Manchester United, Real Madrid
Sort can help me seperate fiels by the -t ; tag. then -k3,3 can help me select the third field (88). Now let's say I wan to delete this string (88) instead of sorting out, what command can help me? Is there also a command that can help me move the strings from position 88 to position 121 and vice versa?
It sounds crazy to me if I would have to use regular expressions with substitute :s everytime (espcially for moving things) when sort can divide fields by strings

Loop predefined sequence through cells in excel

Have been searching for a few hours now I'm stuck. Not really sure what I'm searching for but guessing some VBA.
What I want to do in excel is this:
Have a predefined list i.e. [a,a#,b,c,c#...g#]
Now when somebody enters value 'A' into cell A20 then A19 will be the next on the list 'A#', A18 will be 'B', A17 will be 'C' etc.
If the value C is entered into cell A20 then A19 would be 'C#' and so on...
Once the list reaches G# it shall repeat from A again. This would repeat until cell A2 is reached.
Even a point in the right direction would be great as I don't really know what to search for. Have tried 'arrays' 'loop' 'cycle' without much luck.
Thanks in advance
You would do better learning the basics of VBA than searching for odd terms. Search for "Excel VBA Tutorial". There are many to choose from so try a few then complete the one that matches your learning style. I prefer books. I visited a good library; reviewed their Excel VBA Primers and then the borrowed what I thought were the best to try at home. Finally I bought the best as a permenent reference book.
Your questions is very unclear but I think you need a For Each loop within a Do loop. You will find an introduction to loops near the start of any tutorial or primer. Try to develop this:
Sub demo()
Dim CellId As Variant
Dim LoopCount As Long
' #### Replace Tidy with the name of a worksheet in your workbook.
With Worksheets("Tidy")
Do While True
For Each CellId In Array("A20", "A19", "A18", "A17")
Debug.Print CellId & "=" & .Range(CellId).Value
If LoopCount >= 3 Then
Exit Do
End If
Next
LoopCount = LoopCount + 1
Loop
End With
End Sub

Conditional Vlook up without using VBA

I want to convert an input to desired output. Kindly help.
In the output - the columns value should start from most recent (year)
Please click this to see data
Unfortunately VLOOKUP is not able to fulfill that ask. However the INDEX-function can.
Here is a good read on how to use it:
http://fiveminutelessons.com/learn-microsoft-excel/use-index-lookup-multiple-values-list
This will work for you spreedsheet, if your input table starts at A1 without a header and your output table starts at H3 with the first ID.
You get this by copy&pasting the first column of your input table to column H and then remove duplicates.
{=IF(ISERROR(INDEX($A$1:$C$7,SMALL(IF($A$1:$A$7=$H$3,ROW($A$1:$A$7)),ROW(1:1)),3)),"",
INDEX($A$1:$C$7;SMALL(IF($A$1:$A$7=$H$3,ROW($A$1:$A$7)),ROW(1:1)),3))}
Let's look at the formula step by step:
The curly brackets tell excel that this is an array formula, the interesting part for you is: when you've inserted the formula (without curly brackets) press shift+ctrl+enter, excel will then know that this is an array formula.
'error at formula?, then blank, else formula
=IF(ISERROR(....),"",...)
When you autofill this formula you probably dont know how many instances of your lookup variable are. So when you put this formula in 4 cells, but there are only 3 entries, this bit will keep the cell blank instead of giving an error.
INDEX($A$1:$C$7,SMALL(IF($A$1:$A$7=$H$3,ROW($A$1:$A$7)),ROW(1:1)),3))
$A$1:$C$7 is your data matrix. Your IDs (in your case 125 and 501) are to be found in $A$1:$A$7. ROW(1:1) is the absolute(!) rowID, 3 the absolute(!) column id. So when you move your input table those values have to be changed.
What exactly SMALL and INDEX do are well described in the link above. (Or at least better than I could.)
Hope that clarified some parts,
Tom

Delimiting columns very specifically

I've got a column (with many thousands of rows) which I'd like to delimit into multiple rows. I have some experience using regular expressions in Excel, and I have some experience using delimiters in excel, but this one is just a tad too hard..
Let me give you three example-lines:
- 23-12-05: For sale for 2000. 2010-09-09: Not found
- 25-11-09: For sale for 3400. Last date found: 2010-07-08
- 18-06-08: For sale for 5500. 21-07-09: Changed from 5500 to 4900. 16-09-09: Jumped from 4900 to 4700. 2010-02-04: Not found
Most other lines follow these structures. How can I create a new column based on just the first symbols before [COLON]; A second column based on the symbols between the first [COLON] and the first [DOT]. How can I continue to the last IF the text LAST DATE is not found? Finally: How can I use regex (or another way) to use the text 'NOT FOUND' to paste the last date into a new column?
Trust me, I have been at this for quite some time now (sigh). Any help is much appreciated!
you can actually use formulas for this.
Assuming the text is in A1,
B1: =LEFT(A1,FIND(":",A1)-1)
C1: =MID(A1,FIND(":",A1)+1,FIND(".",A1,FIND(":",A1))-FIND(":",A1))
D1: =MID(A1,FIND(".",A1,FIND(":",A1))+1,LEN(A1))
E1: =MID(A1,FIND("Not found",A1)-12,10)
(I'm assuming the date format does not change for the E1)
By the way, this also works for me, to get the last date in a cell:
=LOOKUP(9999999999999999,FIND("**-**-**",A1,ROW($1:$1024)))
Only problem here is: I haven't the slightest clue what exactly I am doing here.
For example, I'd like to use the same code to find the FIRST occurence of a date.
Can anyone explain this code to me? Why am I searching for a very high number? What is it in this code that makes that I find the last occurence? What does it mean that the 'starting number' is "row(1:1024)"?
Anybody knows?

How to parse text-based table in C++

I am trying to parse a table in the form of a text file using ifstream, and evaluating/manipulating each entry. However, I'm having trouble figuring out how to approach this because of omissions of particular items. Consider the following table:
NEW VER ID NAME
1 2a 4 "ITEM ONE" (2001)
1 7 "2 ITEM" (2002) {OCT}
1.1 10 "SOME ITEM 3" (2003)
1 12 "DIFFERENT ITEM 4" (2004)
1 a4 16 "ITEM5" (2005) {DEC}
As you can see, sometimes the "NEW" column has nothing in it. What I want to do is take note of the ID, the name, the year (in brackets), and note whether there are braces or not afterwards.
When I started doing this, I looked for a "split" function, but I realized that it would be a bit more complicated because of the aforementioned missing items and the titles becoming separated.
The one thing I can think of is reading each line word by word, keeping track of the latest number I saw. Once I hit a quotation mark, make note that the latest number I saw was an ID (if I used something like a split, the array position right before the quotation mark), then keep record of everything until the next quote (the title), then finally, start looking for brackets and braces for the other information. However, this seems really primitive and I'm looking for a better way to do this.
I'm doing this to sharpen my C++ skills and work with larger, existing datasets, so I'd like to use C++ if possible, but if another language (I'm looking at Perl or Python) makes this trivially easy, I could just learn how to interface a different language with C++. What I'm trying to do now is just sifting data anyways which will eventually become objects in C++, so I still have chances to improve my C++ skills.
EDIT: I also realize that this is possible to complete using only regex, but I'd like to try using different methods of file/string manipulation if possible.
If the column offsets are truly fixed (no tabs, just true space chars a la 0x20) I would read it a line at a time (string::getline) and break it down using the fixed offsets into a set of four strings (string::substr).
Then postprocess each 4-tuple of strings as required.
I would not hard-code the offsets, store them in a separate input file that describes the format of the input - like a table description in SQL Server or other DB.
Something like this:
Read the first line, find "ID", and store the index.
Read each data line using std::getline().
Create a substring from a data line, starting at the index you found "ID" in the header line. Use this to initialize a std::istringstream with.
Read the ID using iss >> an_int.
Search the first ". Search the second ". Search the ( and remember its index. Search the ) and remember that index, too. Create a substring from the characters in between those indexes and use it to initialize another std::istringstream with. Read the number from this stream.
Search for the braces.