Array

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
eugenefoxx
Posts: 33
Joined: Thu Jun 04, 2015 11:59 pm

Array

Post by eugenefoxx »

Tell me how to present the page in calc as an array so that you can also manipulate data (counting by an element, finding values, etc.).
LibreOffice 4.4.0.3 on Windows 8.1
FJCC
Moderator
Posts: 9277
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Array

Post by FJCC »

The functions INDEX() and OFFSET() might be what you are looking for but I am not really sure. Please give a concrete example of what you want to do.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
User avatar
robleyd
Moderator
Posts: 5084
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Array

Post by robleyd »

Or possibly a Pivot Table (formerly known as Data Pilot) might do what you need. https://wiki.openoffice.org/wiki/Docume ... /DataPilot
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
eugenefoxx
Posts: 33
Joined: Thu Jun 04, 2015 11:59 pm

Re: Array

Post by eugenefoxx »

Attached file, greatly reducing it. It has formulas, but since the size of the information is large, I want to simplify the calculations in the array. And this file is one of many that I want to include in the analysis file.
Attachments
Stock.ods
(124.42 KiB) Downloaded 173 times
LibreOffice 4.4.0.3 on Windows 8.1
eugenefoxx
Posts: 33
Joined: Thu Jun 04, 2015 11:59 pm

Re: Array

Post by eugenefoxx »

Please help me, how to insert the data we got

Code: Select all

 
         i = arr2(r)(0)
		e = arr2(r)(4)
into the range Sheets(0).getCellRangeByName("K6:K24")

Code: Select all

 
Sub test
Dim c, r, i, e as integer

arr1 = ThisComponent.Sheets(0).getCellRangeByName("B6:I24").getDataArray()
arr2 = ThisComponent.Sheets(1).getCellRangeByName("L6:P60000").getDataArray()

For a = 0 to ubound(arr1) 
	For r = 0 to ubound(arr2)
		If arr1(a)(0) = arr2(r)(3) Then

		i = arr2(r)(0)
		e = arr2(r)(4) 
		print i
		print e	
'		oRange1 = ThisComponent.Sheets(0).getCellRangeByName("K6:K24").setDataArray(i)
		
		End If
	Next r
Next a

End Sub
LibreOffice 4.4.0.3 on Windows 8.1
Post Reply