Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
2-Basic Functions.doc
Скачиваний:
0
Добавлен:
30.11.2019
Размер:
5.98 Mб
Скачать

Basic Functions : FIXED 3

Paste Special II - Removing formulae 4

Secret StarWars games 4

Using Names as constants 6

Listing Cell Notes 7

Basic functions: CHOOSE 10

Checkerboard shading 10

Using Pop Up Notes in Cells 11

Macros: Text Utilities Part I 12

Adding a dialog: Part I 16

Adding a dialog: Part II 21

Formatting ratios 25

Filling a multiplication chart 26

Macros: Text Utilities Part I 28

Summing across sheets 33

Counting unique entries in a range 34

Spelling out numbers 34

Datapilot Revisited 38

DataPilot Revisited II 41

Splitting a string into characters 43

Basic functions: TEXT 43

Ranking and sorting data I 44

Conditional summation revisited 45

Regression analysis I : Basic linear formulas 46

Regression Analysis II : Basic functions, charting 47

Regression Analysis III : LINEST 50

Rounding to the nearest nickel: MROUND() 51

Looking up data in tables V 52

Combining data in cells 52

Rounding functions I 53

Easter formula 53

OpenOffice Calc Tips 54

Date & Time : Calculating Dates of Holidays 54

Financial Functions 3 : Complex Accumulation 56

Data Consolidation 101 58

Basic Functions: FREQUENCY 60

Largest values in an array 61

Advanced Functions: INDIRECT 62

Counting letters in a string 63

Macro : Sorting sheets 63

Basic functions : SUBTOTAL 64

Filling a Cell Range with a Series 66

Converting text to dates 68

Basic Functions : CELL 68

Rounding Numbers to Thousands and Millions 69

Text manipulation 1 : Concatenation 70

Copying Formulas while preserving references 70

SUMPRODUCT and conditional summation 72

Custom Time Formatting for a timesheet 73

Data Validation 101 73

Basic functions : SUMIF 77

Adding a background graphic 78

Using the Navigator 84

Introduction to the Status Bar 87

Charting: Editing charts : part 2 88

Charting: Editing charts : part 3 92

Autocorrect 95

Macros: Getting Cell Information 99

Charting: Pie charts 101

One Response to “Charting: Pie charts” 106

Basic Functions: ISERR 107

Database functions: DAVERAGE 107

Basic Functions : fixed

In OpenOffice Calc, the FIXED function returns a text representation of a number rounded to a specified number of decimal places.

The arguments to the function are :

FIXED(number, decimal_places, no_commas) where

  • number… is the number to round.

  • decimal_places is the number of decimal places to display in the result.

  • no_commas If this parameter is set to TRUE, the result will not display commas. If it is set to FALSE, it will display commas in the result.

We see a few examples of the FIXED function below.

This entry was posted on Sunday, September 25th, 2005 at 11:35 am and 

Paste Special II - Removing formulae

September 20th, 2005

The paste special feature is useful for preserving the values in a spreadsheet - but removing the formulae that generated those values. This may be required to preserve proprietary equations.

To remove the formulae for a range of cells, select and copy the desired range. Do not unselect the range. Now click on Edit - Paste Special - see below.

Make sure the Formulas box is unchecked. After you click OK, the formula is removed but the value is preserved.

Posted in Using OpenOffice Calc | No Comments »

Secret StarWars games

September 16th, 2005

Open Office Calc has an interesting Easter egg - a hidden feature that might not be obvious or documented. Programmers sometimes bury Easter Eggs in their programs or web sites to add extra depth and challenge users to find them.

In an empty cell, type the following formula..=GAME(”StarWars”) This is what you will see…

After you have selected your hero, the game begins. Another screen shot…

You can only play the game once. To play again - exit OOo Calc and the quickstarter before restarting.

Posted in Using OpenOffice Calc | No Comments »

Using Names as constants

September 15th, 2005

There are many mathematical and statistical constants in use that are needed in spreadsheets. For OpenOffice Calc, only PI has been hardwired as a function call - PI()

Using defined names is a quick and easy way to define constants in your spreadsheet that will also make your formulae more legible and maintainable. There will also be no need to have hidden sheets where the constants are defined. In this example, we will define Euler’s constant - e

Open the Define Names dialog as shown below.

Instead of assigning/associating the name with a particular cell, assign a fixed value as shown below. Exit the dialog

The named constant can now be used in formulae as shown below. Note that Names defined in this way do not appear in the name box - which is just above the cells area on the left.

Posted in Using OpenOffice Calc | 1 Comment »

Listing Cell Notes

September 14th, 2005

Here is a simple macro that creates a new sheet in the Calc document with a listing of all the notes (comments) found.

Notes can be added to any cell with Insert - Note - see below.

The Basic code for gathering all of these notes and adding them to a new sheet is given below. Items in the listing I’d like to draw your attention to..

  • Creating new sheets with the insertNewByName method.

  • The PrintableAddressOfCell and ColumnNumberToString routines convert row and column cell offsets to human readable notation - and were written by Andrew Pitonyak.

  • The notes (annotations) for each sheet are traversed using a For loop in the exact same way as the sheets of the document.

Sub AddCommentSheet

Dim oSheets, oSheet Dim oRange, oCell Dim oAnnotations, oNote Dim i As Integer Dim j As Integer

oSheets = ThisComponent.Sheets

oSheets.insertNewByName (”Comments”, oSheets.getCOunt())

oSheet = oSheets.getByName(”Comments”)

oRange = oSheet.getCellRangeByName(”B1:C1″) oRange.merge(True)

oCell = oSheet.getCellByPosition(1,0) oCell.setString(”Comment listing”) oCell.CellBackColor = 16764057 oCell.HoriJustify = com.sun.star.table.CellHoriJustify.CENTER

oCell = oSheet.getCellByPosition(1,1) oCell.setString(”Created on …” & Now())

oCell = oSheet.getCellByPosition(1,3) oCell.setString(”Sheet”) oCell.CellBackColor = 16764057 oCell = oSheet.getCellByPosition(2,3) oCell.setString(”Cell”) oCell.CellBackColor = 16764057 oCell = oSheet.getCellByPosition(3,3) oCell.setString(”Note”) oCell.CellBackColor = 16764057

CurRow = 4 For j = 0 To oSheets.getCount()-1 oSheet2 = oSheets.getByIndex(j) oAnnotations = oSheet2.getAnnotations()

For i = 0 To oAnnotations.getCount()-1 oNote = oAnnotations.getByIndex(i) oCell = oSheet.getCellByPosition(1,CurRow+i) oCell.setString(oSheet2.Name) oCell = oSheet.getCellByPosition(2,CurRow+i) oCell.setString(PrintableAddressOfCell(oNote.getParent()) oCell = oSheet.getCellByPosition(3,CurRow+i) oCell.setString(oNote.getString()) Next CurRow = CurRow + i Next

End Sub

Function PrintableAddressOfCell(oCell) As String If IsNull(oCell) OR IsEmpty(oCell) Then PrintableAddressOfCell = “Unknown” Else PrintableAddressOfCell = ColumnNumberToString(oCell.CellAddress.Column) &_ Cstr(oCell.CellAddress.Row+1) End If End Function

Function ColumnNumberToString(ByVal nColumn As Long) As String Dim s As String Do While nColumn >= 0 s = Chr$(65 + (nColumn MOD 26)) & s nColumn = nColumn \ 26 - 1 Loop ColumnNumberToString = s End Function

The newly created comment sheet is shown below.

Posted in OpenOffice Basic | No Comments »