Outils pour utilisateurs

Outils du site


issue94:libreoffice

In past articles, I have discussed and used functions to illustrate other functionality in Calc, but today, I am going to show you three different ways to enter functions. I'll show you the structure of a function; we will create data for a spreadsheet; then I will apply each of the input methods: Function Wizard, Function List, and manual entry. Structure of a Function It helps to understand the structure of functions if you plan to use them. I will use the following function for my discussion of function structure: =PRODUCT(B5, A1:A6, 0.25) Functions are always a part of a formula. When you use any formula or function, it must begin with an equals sign (=). If you use multiple functions, the equals sign is required only at the beginning. The start of a function is the function name. By tradition, function names are entered in all upper-case letters, but Calc will recognize them in lower or mixed case letters. Keeping with the tradition, I usually enter function names in all capitals. The name of our function in the example is PRODUCT. PRODUCT is to multiplication what SUM is to addition, it multiplies all its arguments into a final total. After the function name is the argument list, separated by commas, and surrounded by parenthesis. This is the (B5, A1:A6, 0.25) part of our sample function. Arguments can come in several forms, and the function will usually expect a certain type in each position of the arguments. Arguments can take the form of numbers (9), “Quoted text”, cell reference (C3), cell range (C3:C10), comparisons (C3 > C1), or another function. Note that quotes around a number, “9”, defines the argument as text – and not a number.

Dans le passé, j'ai présenté et utilisé des fonctions pour illustrer d'autres fonctionnalités de Calc, mais aujourd'hui, je vais vous montrer trois façons différentes de saisir des fonctions. Je vous montrerai la structure d'une fonction ; nous créerons des données pour une feuille de calcul ; puis j'appliquerai chacune des méthodes de saisie : l'assistant Fonctions, la liste de fonctions et l'entrée manuelle.

Structure d'une fonction

Comprendre la structure des fonctions aide si vous prévoyez de vous en servir. Je vais utiliser la fonction suivante pour présenter la structure des fonctions :

=PRODUIT(B5; A1:A6; 0,25)

Les fonctions font toujours partie d'une formule. Quand vous utilisez n'importe quelle formule ou fonction, elle doit toujours commencer par un signe « = ». Si vous utilisez plusieurs fonctions, le signe « = » n'est nécessaire qu'au début.

Le début de la fonction est le nom de la fonction. Traditionnellement, les noms de fonctions sont saisis en majuscules, mais Calc reconnaît aussi les minuscules ou un mélange des deux. Conservant la tradition, je saisis habituellement mes noms de fonction en majuscules. Le nom de notre fonction exemple est PRODUIT. PRODUIT est à la multiplication ce que SOMME est à l'addition ; le résultat final est la multiplication de tous ses arguments.

La liste des arguments, séparés par des points-virgules et encadrés par des parenthèses, suit le nom de la fonction. C'est la partie (B5; A1:A6; 0,25) de la fonction exemple. La forme des arguments peut différer et la fonction s'attendra habituellement à un certain type d'argument dans chacune des positions. Les arguments peuvent prendre la forme d'un nombre (9), d'un « texte entre guillemets », d'une référence de cellule (B5), d'un groupe de cellules (A1:A6), d'une comparaison (C3>C1) ou d'une autre fonction. Notez qu'un nombre entre guillemets, « 9 », est un argument de type texte, pas un nombre.

Setting Up the Sheet I work with installers of controlled access systems. When setting up a new system, it is necessary to calculate how many power supplies are needed in order to power the equipment for the site. We use a formula for calculating the voltage drop at each device. The calculation involves the input voltage, the current draw of the device plus the current draw of any devices after it, multiplied by the resistance of the length of wire to the device. The basic formula is Vout = Vin – I(DR) where Vin is the input voltage, I is the current draw of the device and any devices after it, D is the length of wire (in feet), and R is the resistance of the wire per foot. Let's set up a sheet to help us calculate the voltage at each device. Start with the label “Start Volts” in cell A1. In cells A2:E2 put the following column headings: Device, Amps, Distance, Ohms/Foot, and Voltage. In cell B1 put 13.2 for your starting voltage. In A3:A5 put 1, 2, 3 for the devices. B3:B5 are the current draw for each device. Use 0.3, 0.25, and 0.5. The three distances for the wire are 75, 110, and 120. For the Ohms/Foot, use 0.00639 for all three. This is the approximate Ohms per foot for 16 AWG (US). Leave the Voltage column blank. This is where we will enter our formulas.

Préparer la feuille

Je travaille avec des installateurs de systèmes de contrôle d'accès. Lors du paramétrage d'un nouveau système, il est nécessaire de calculer combien d'alimentations seront nécessaires pour fournir la puissance à l'équipement sur le site. Nous utilisons une formule pour calculer la chute de tension pour chaque appareil. Le calcul comprend la tension d'entrée, le courant consommé par l'appareil plus celui consommé par les appareils suivants, multiplié par la résistance de la longueur du câble allant jusqu'à l'appareil. La formule de base est :

Vout = Vin - I(DR)

Où Vin est la tension d'entrée, I, le courant consommé par l'appareil et les appareils suivants, D est la longueur de câble (en m) et R, la résistance du câble par mètre. Préparons une feuille de calcul pour calculer la tension Vout disponible pour chaque appareil.

Commencez avec un titre « Tension initiale » dans la cellule A1. Dans les cellules A2:E2, placez les titres de colonne suivants : Appareil, Courant, Distance, Résistance/mètre, et Tension disponible. Dans la cellule B1, entrons 13,2 comme tension initiale, en A3:A5, mettons 1, 2, 3 pour les appareils. B3:B5 contient les courants consommés par chaque appareil. Prenons 0,3, 0,25 et 0,5. Les trois longueurs de câbles sont 25, 30 et 40. Pour la résistance par mètre, utilisez 0,0115 pour les trois. C'est la résistance par mètre approximative d'un câble d'une section de 1,5 mm2. Laissez la colonne Tension disponible vide. C'est là que nous entrerons nos formules.

Function Wizard The function wizard is the most complete method for entering formulas with functions. It is also the slowest because of the many options. The wizard is a great way to work through the set up of a complicated formula by allowing you to deal with individual pieces of information one at a time. We will use the wizard to create the voltage formula for the first device. There are three ways to access the Function Wizard. Select cell E3 and do one of the following: • Click the Function Wizard button on the formula toolbar. • Insert > Function… • CTRL + F2 The Function Wizard displays a function list box to the left. The Category drop-down list allows you to narrow the functions in the list to the selected category. There is also a Last Used category for selecting recently used functions. If you single-click on a function name, it displays a short description of the function to the right. When you double-click on a function, it inserts the function into the formula text box on the bottom right. Notice that the wizard has already inserted the equals sign for you. The right center displays text boxes for entering the arguments for the function. Above the argument boxes, it displays the short description and a list of the arguments and their type. The top right shows the results of the current formula and the formula result is displayed above the formula edit box. Our formula starts with the voltage coming into the device. For the first device this is 13.2 from cell B1, so click into the formula text box at the bottom and type “B1-”. From the category drop down list select Mathematical. Scroll down the list and double-click PRODUCT. The PRODUCT function is added to the formula.

L'assistant Fonction

L'assistant Fonction est la méthode la plus complète pour entrer des formules avec des fonctions. C'est aussi la plus lente du fait du nombre d'options. L'assistant est une bonne façon de construire une formule compliquée, en vous permettant de traiter individuellement les morceaux d'information, chacun à son tour. Nous utiliserons l'assistant pour créer la formule de la tension du premier appareil.

Il y a trois façons d'accéder à l'assistant Fonction. Sélectionnez la cellule E3 et faites une des actions suivantes : • Cliquez sur le bouton Assistant Fonction de la barre de formule. • Insertion > Fonction… • CTRL + F2

L'assistant Fonction affiche une zone de liste des fonctions sur la gauche. La liste déroulante Catégorie vous permet de réduire la liste des fonctions à la catégorie choisie. Il y a aussi une catégorie « Les dernières utilisées » pour n'afficher que celles récemment utilisées. Un simple clic sur un nom de fonction affiche sur la droite une courte explication de la fonction. Si vous double-cliquez sur un nom de fonction, la fonction est insérée dans la zone de texte des formules, en bas à droite. Notez que l'assistant a déjà ajouté le signe égal à votre place. Au centre à droite, des zones de texte sont affichées pour entrer les arguments de la fonction. Au-dessus des zones des arguments, une courte description de la fonction est affichée, avec une liste des arguments et leurs types. En haut à droite, le résultat de la formule en cours est présenté, alors que le résultat global de la formule est présenté au-dessus de la zone d'édition de la formule.

Notre formule commence par la tension initiale. Pour le premier appareil, elle est de 13,2 en cellule B1 ; aussi, cliquez en bas dans la zone de texte des formules et saisissez « B1- ». Dans la liste déroulante des catégories, choisissez Mathématique. Descendez la liste et double-cliquez sur PRODUIT. La fonction PRODUIT est ajoutée à la formule.

Click into the Number 1 text box. The first argument is the sum of all the amps for all the devices. Click on the Function Wizard button to the left of the Number 1 text box. This gives you a blank function wizard screen. Note that you now have Back and Next buttons at the bottom. Select Mathematical from the category list, but this time double-click the SUM function. Click into the Number 1 text box. Use your mouse to select cells B3:B5. The range is added to the Number 1 text box for SUM. Click Back twice to return to the PRODUCT function we started with. Notice that the SUM function is now in the Number 1 text box. Select the Number 2 text box. Double-click on PRODUCT again. In the Number 1 text box for the second PRODUCT function, enter or select the range C3:D3. We are now finished with our formula. The final formula should look like =B1-PRODUCT(SUM(B3:B5),PRODUCT(C3:D3)) Click OK to finish the wizard. NOTE: I could have used the multiplication operator (*) to accomplish the same thing in the PRODUCT function, but I used the function in order to illustrate the ability to use functions as arguments to other functions.

Cliquez dans la zone de texte Nombre 1. Le premier argument est la somme de tous les courants pour tous les appareils. Cliquez sur la bouton assistant Fonction à gauche de la zone de texte Nombre 1. Ceci vous ouvre une fenêtre d'assistant Fonction vierge. Notez que vous avez des boutons Précédent et Suivant en bas. Sélectionnez Mathématique dans la liste des catégories, mais cette fois, double-cliquez sur la fonction SOMME. Cliquez sur la zone de texte Nombre 1. Utilisez votre souris pour sélectionner les cellules B3:B5. Le choix est ajouté à la zone de texte Nombre 1 de SOMME.

Cliquez deux fois sur Précédent pour revenir à la fonction PRODUIT que nous avons commencé. Notez que la fonction SOMME est maintenant dans la zone de texte Nombre 1. Sélectionnez la zone de texte Nombre 2. A nouveau, double-cliquez sur PRODUIT. Dans la zone de texte Nombre 1 de cette deuxième fonction PRODUIT, entrez ou sélectionnez le groupe C3:D3.

Nous avons maintenant fini notre formule. La formule finale devrait ressembler à :

=B1-PRODUIT(SOMME(B3:B5);PRODUIT(C3:D3))

Cliquez sur OK pour fermer l'assistant.

NOTE : J'aurai pu utiliser l'opérateur de multiplication (*) dans la fonction PRODUIT pour obtenir le même résultat, mais j'ai utilisé la fonction pour illustrer la possibilité d'utiliser des fonctions comme arguments d'autres fonctions.

Function List The Function List is the wizard without the bells and whistles. In fact, it is just the function list portion of the wizard. The idea behind it is to help you in adding functions directly into the cells. You can bring up the Function List by using the menus, Insert > Function List, or by clicking the Functions icon in the sidebar. When you select a function name in the list, a short description appears at the bottom of the list. The Function List also has a category item called Last Used, containing a list of the functions you have used recently. Let's use it to create the formula for the second device. Select the cell E4. Select the Input Line text box on the function toolbar. This is the best place to enter functions using the function list. For this device, we need the ending voltage of the previous one, so start the formula with “=E3-”. You should see PRODUCT listed on your Last Used list. Double-click PRODUCT to add it to the formula. With the cursor between the parenthesis, double-click SUM, which should also show in the Last Used list. Select cell range B4:B5. Click into the formula and use the arrow keys to move the cursor outside SUM's parenthesis. Type a comma then double-click PRODUCT again. Type in or select the range C4:D4. Press Enter. The final result should look like =E3-PRODUCT(SUM(B4:B5),PRODUCT(C4:D4))

Liste de fonctions

La liste de fonctions est l'assistant sans tout le bastringue. En fait, c'est juste la partie liste de fonctions de l'assistant. L'idée derrière cela, c'est de vous aider à ajouter directement des fonctions dans les cellules. Vous pouvez afficher la liste des fonctions par le menu Insertion > Liste des fonctions ou en cliquant sur l’icône Fonctions du volet latéral. Quand vous sélectionnez un nom de fonction dans la liste, une courte description apparaît en bas de la liste. La liste de fonctions a aussi une catégorie appelée Les dernières utilisées, qui contient la liste des fonctions que vous avez utilisées récemment.

Utilisons-la pour créer la formule du second appareil. Sélectionnez la cellule E4. Sélectionnez la zone de saisie de texte dans la barre de formule. C'est le meilleur endroit pour entrer une fonction en utilisant la liste de fonctions. Pour cet appareil, nous avons besoin de la tension disponible à l'entrée du premier appareil ; aussi, commencez la formule avec « =E3- ». Nous devrions voir la fonction PRODUIT dans la liste des dernières utilisées. Double-cliquez sur PRODUIT pour l'ajouter à la formule. Le curseur étant placé entre les parenthèses, double-cliquez sur SOMME, qui est aussi affiché dans Les dernières utilisées. Sélectionnez la tranche B4:B5. Cliquez dans la formule et utilisez les touches fléchées pour déplacer le curseur hors des parenthèses de SOMME. Tapez un point-virgule et double-cliquez à nouveau sur PRODUIT. Saisissez ou sélectionner la rangée C4:D4. Appuyez sur Entrée.

Le résultat final devrait être :

=E3-PRODUIT(SOMME(B4:B5);PRODUIT(C4:D4))

Manual Entry Manual entry is just that, typing the formula directly into the cell from memory. The formula for the last device is the easiest because you no longer need the sum of device currents because it is the only one left. Select cell E5 and type in =E4-PRODUCT(B5, PRODUCT(C5:D5)) and press Enter. While you are typing in the functions, Calc will show you a hint balloon of the function and its arguments. Calc gives you three different methods for entering functions into a cell. Use the Function Wizard when you need as much guidance as possible, or when entering a complicated formula for the first time. The Function List gives you a list and short descriptions to aid you in using the correct arguments and functions in your formula. The manual method is great for entering short formulas, using functions you are familiar with, or repeating a formula you have used before.

Entrée manuelle

L'entrée manuelle consiste simplement à taper de mémoire la formule directement dans la zone de saisie de texte. La formule pour le dernier appareil est la plus facile puisqu'il n'y a plus de somme des courants des appareils à faire, puisque c'est le dernier. Sélectionnez la cellule E5 et saisissez :

=E4-PRODUIT(B5; PRODUIT(C5:D5))

et appuyez sur Entrée. Pendant que vous tapez la fonction, Calc vous affiche une info-bulle de la fonction et de ses arguments.

Calc vous offre trois méthodes pour entrer des fonctions dans une cellule. Utilisez l'assistant Fonction quand vous avez besoin d'être guidé précisément ou quand vous entrez une formule compliquée pour la première fois. La liste de fonctions vous donne une liste, avec une courte explication, pour vous aider à utiliser les bons arguments et fonctions dans votre formule. La méthode manuelle est bien pour entrer des formules courtes, pour utiliser des fonctions qui vous sont familières ou pour répéter une formule que vous avez déjà utilisée.

issue94/libreoffice.txt · Dernière modification : 2015/04/08 14:44 de andre_domenech