AnvÀnda villkorlig formatering

Using the menu command Format - Conditional - Condition, the dialog allows you to define conditions per cell, which must be met in order for the selected cells to have a particular format.

Varningssymbol

För att anvÀnda villkorlig formatering mÄste Automatisk berÀkning vara aktiverad. VÀlj Verktyg - CellinnehÄll - Automatisk berÀkning (en bock visas intill kommandot nÀr Automatisk berÀkning Àr aktiverad).


Med villkorlig formatering kan du t.ex. markera summor som överstiger medelvÀrdet för alla summor. Om summorna Àndras, Àndras Àven formateringen utan att du behöver ange en annan formatmall manuellt.

SÄ hÀr definierar du villkoren

  1. Markera de celler som skall fÄ en villkorlig formatmall.

  2. Choose Format - Conditional - Condition.

  3. Ange villkor i dialogrutan. En detaljerad beskrivning av dialogrutan finns i LibreOffice-hjÀlpen, och nedan finns ett exempel:

Exempel pÄ villkorlig formatering: Markera summor över/under medelvÀrdet

Steg 1: Generera talvÀrden

Du vill kanske speciellt framhÀva vissa vÀrden i dina tabeller. I en tabell med omsÀttningar kan du t.ex. lÀgga en grön bakgrund för alla vÀrden som ligger över genomsnittet och en röd bakgrund för alla vÀrden som ligger under. Detta kan du Ästadkomma med den villkorliga formateringen.

  1. First of all, create a table in which a few different values occur. For your test you can create tables with any random numbers:

    Ange formeln =SLUMP() i en cell. Du fÄr dÄ ett slumptal mellan 0 och 1. Om du vill ha heltal mellan 0 och 50 skriver du formeln =HELTAL(SLUMP()*50).

  2. Skapa en rad med slumpmÀssiga tal genom att kopiera formeln. Klicka i det nedre högra hörnet pÄ den markerade cellen och dra till höger tills du har markerat cellomrÄdet du ville markera.

  3. Skapa fler rader med slumpmÀssiga tal genom att dra cellens hörn till det nedre högra hörnet i tabellen.

Steg 2: Definiera cellformatmallar

The next step is to apply a cell style to all values that represent above-average turnover, and one to those that are below the average. Ensure that the Styles window is visible before proceeding.

  1. Klicka pĂ„ en tom cell. Öppna snabbmenyn och vĂ€lj Formatera celler.

  2. In the Format Cells dialog on the Background tab, click the Color button and then select a background color. Click OK.

  3. In the Styles deck of the Sidebar, click the New Style from Selection icon. Enter the name of the new style. For this example, name the style "Above".

  4. Om du vill definiera en formatmall till klickar du i en tom cell igen och följer ovanstÄende beskrivning. Ge cellen en annan bakgrundsfÀrg och ge den ett namn (i det hÀr exemplet "Nedanför").

Steg 3: BerÀkna medelvÀrde

I det hÀr exemplet berÀknar vi medelvÀrdet av de slumpmÀssiga talen. Resultatet placeras i en cell:

  1. Placera markören i en tom cell, till exempel J14, och vÀlj Infoga - Funktion.

  2. Select the AVERAGE function. Use the mouse to select all your random numbers. If you cannot see the entire range, because the Function Wizard is obscuring it, you can temporarily shrink the dialog using the Shrink icon.

  3. StÀng Funktionsguiden genom att klicka pÄ OK.

Steg 4: AnvÀnda cellformatmallar

Nu behöver du bara anvÀnda den villkorliga formateringen pÄ din tabell.

  1. Markera alla celler med slumptalen i tabellen.

  2. Choose the Format - Conditional - Condition command to open the corresponding dialog.

  3. VĂ€lj nu följande villkor: Om cellvĂ€rdet Ă€r mindre Ă€n J14, formatera dĂ„ med "Under" och om cellvĂ€rdet Ă€r lika med eller större Ă€n J14, formatera dĂ„ med "Över".

Steg 5: Kopiera cellformatmall

Du vill anvÀnda den villkorliga formateringen pÄ fler celler i efterhand:

  1. Klicka pÄ en av cellerna som har villkorlig formatering.

  2. Kopiera cellen till urklipp.

  3. Markera cellerna som ska ha samma formatering.

  4. Choose Edit - Paste Special - Paste Special. The Paste Special dialog appears.

  5. In the Paste area, check only the Formats box. All other boxes must be unchecked. Click OK. Or you can click the Formats only button instead.