Libreoffice : Referencing cells in another worksheet via FIND(), LOOKUP(), or EXACT()?

jbobbylopez picture jbobbylopez · Mar 28, 2013 · Viewed 12.3k times · Source

I'm trying to learn LibreOffice's scripting capabilities, and have a specific scenario that I haven't been able to figure out.

What I'm trying to do is get the value from another worksheet, by doing a search for a specific value in an adjacent cell.

For example, lets say I have two worksheets:

Worksheet1

Workseet1

And Worksheet2

enter image description here

What i'm trying to do, is populate each value in Worksheet1, Column B with the associated value from Worksheet2, Column B. The way I'm trying to do this is to write a statement that finds and uses the month in Worksheet1 as the search criteria against Worksheet2, Column C.

So far I haven't had much luck, but here's what I've been trying to work with:

='Worksheet2'.$C.FIND('Worksheet1'.$A1).$B1

This is more than likely wrong, but I'm trying to express the logic, which is "in Worksheet2, find the value from Worksheet1:$A1, and give me the value from Worksheet2:$B1"

Essentially what it comes down to is that I do not yet understand the syntax and paradigms of this language.

Any thoughts on how I can accomplish what I'm trying to do above?

Also, I would be interested in any links for online tutorials about this language (LibreOffice Basic?)

Thanks in advance!

Answer

aggh picture aggh · May 16, 2013

There is a function called VLOOKUP that you might want to try.

Syntax for your example would be:

=VLOOKUP(A1,'Worksheet2'.B1:C12,1)