[Solved] Copy style to new sheet
[Solved] Copy style to new sheet
I can't seem to find how to copy styles I've created in one document to another. Also, is there a way to apply more than 3 conditional formats to a range?
Last edited by pinkwaz on Wed Apr 28, 2010 3:05 pm, edited 2 times in total.
OpenOffice 3.2 on Windows Vista
Re: copy style to new sheet
Create a new template from the spreadsheet and use it. File > Template > Create etc.pinkwaz wrote:I can't seem to find how to copy styles I've created in one document to another.
Have a look at the Style and Template chapters at
OpenOffice.org 3 User Guides
LibreOffice 7.3.7. 2; Ubuntu 22.04
-
- Volunteer
- Posts: 918
- Joined: Sun May 31, 2009 1:35 am
- Location: Sydney, Australia
Re: copy style to new sheet
If you copy cells with the styles in the first doc then paste those cells into the second doc you will find that the styles will now be in the second doc.
For more than 3 cond formats you use "Formula is" then the STYLE function with an argument that is a formula that returns the appropriate style name.
Attached doc uses STYLE(VLOOKUP($Sheet1.C1;$Sheet1.$A$1:$A$7;2)) with lookup table in A1:B7 to control which of 7 styles (Default, Green, Red, Blue, Magenta, Yellow, Cyan) is applied to C1.
C1<1, Default
C1<2, Green
C1<3, Red
C1<4, Blue
C1<5, Magenta
C1<6, Yellow
C1>=6, Cyan Ken Johnson
For more than 3 cond formats you use "Formula is" then the STYLE function with an argument that is a formula that returns the appropriate style name.
Attached doc uses STYLE(VLOOKUP($Sheet1.C1;$Sheet1.$A$1:$A$7;2)) with lookup table in A1:B7 to control which of 7 styles (Default, Green, Red, Blue, Magenta, Yellow, Cyan) is applied to C1.
C1<1, Default
C1<2, Green
C1<3, Red
C1<4, Blue
C1<5, Magenta
C1<6, Yellow
C1>=6, Cyan Ken Johnson
AOO 4.1.3 on Ms Windows 10
Help improve this forum by clicking the EDIT button on your first post then adding "[Solved]" to its heading once a solution to your problem has been provided.
Help improve this forum by clicking the EDIT button on your first post then adding "[Solved]" to its heading once a solution to your problem has been provided.
Re: Copy style to new sheet
I downloaded your doc and I think I'm close to getting this, but can't seem to figure out where the formulas are for c1<#. Can I have data on sheet one with a conditional formatting that tests a cell and pulls the formatting data from sheet 2?
OpenOffice 3.2 on Windows Vista
-
- Volunteer
- Posts: 918
- Joined: Sun May 31, 2009 1:35 am
- Location: Sydney, Australia
Re: Copy style to new sheet
The formula for C1<# is the VLOOKUP function that is inside the STYLE function in the Conditional Formatting dialog...
VLOOKUP($Sheet1.C1;$Sheet1.$A$1:$A$7;2)
Important thing to notice is the absence of the 4th argument in this VLOOKUP formula, ie the formula is not: VLOOKUP($Sheet1.C1;$Sheet1.$A$1:$A$7;2;0)
Without that zero, VLOOKUP does not look for a perfect match between the C1 value and the values in Sheet1.A1:A7.
Instead it looks for the greatest value that is less than or equal to C1's value.
It is essential that the values in Sheet1.A1:A7 be in ascending order for VLOOKUP to return a meaningful result when used this way.
Now with Sheet1.A1:A7 = {0;1;2;3;4;5;6} and C1=5.5, the VLOOKUP matches 5.5 with 5 because there is no 5.5 but 5 is the largest column A value that does not exceed 5.5.
With Sheet1.B1:B7 = {"Default";"Green";"Red";"Blue";"Magenta";"Yellow";"Cyan"}, the VLOOKUP goes on to return the value corresponding to the 5, ie "Yellow".
So, the style applied to C1 is then "Yellow".
It can even be a part of the VLOOKUP formula...
VLOOKUP($Sheet1.C1;{0;"Default"|1;"Green"|2;"Red"|3;"Blue"|4;"Magenta"|5;"Yellow"|6;"Cyan"};2)
What conditional rule are you trying to apply to your cell(s)?
Ken Johnson
VLOOKUP($Sheet1.C1;$Sheet1.$A$1:$A$7;2)
Important thing to notice is the absence of the 4th argument in this VLOOKUP formula, ie the formula is not: VLOOKUP($Sheet1.C1;$Sheet1.$A$1:$A$7;2;0)
Without that zero, VLOOKUP does not look for a perfect match between the C1 value and the values in Sheet1.A1:A7.
Instead it looks for the greatest value that is less than or equal to C1's value.
It is essential that the values in Sheet1.A1:A7 be in ascending order for VLOOKUP to return a meaningful result when used this way.
Now with Sheet1.A1:A7 = {0;1;2;3;4;5;6} and C1=5.5, the VLOOKUP matches 5.5 with 5 because there is no 5.5 but 5 is the largest column A value that does not exceed 5.5.
With Sheet1.B1:B7 = {"Default";"Green";"Red";"Blue";"Magenta";"Yellow";"Cyan"}, the VLOOKUP goes on to return the value corresponding to the 5, ie "Yellow".
So, the style applied to C1 is then "Yellow".
The lookup table can be on any sheet.Can I have data on sheet one with a conditional formatting that tests a cell and pulls the formatting data from sheet 2?
It can even be a part of the VLOOKUP formula...
VLOOKUP($Sheet1.C1;{0;"Default"|1;"Green"|2;"Red"|3;"Blue"|4;"Magenta"|5;"Yellow"|6;"Cyan"};2)
What conditional rule are you trying to apply to your cell(s)?
Ken Johnson
AOO 4.1.3 on Ms Windows 10
Help improve this forum by clicking the EDIT button on your first post then adding "[Solved]" to its heading once a solution to your problem has been provided.
Help improve this forum by clicking the EDIT button on your first post then adding "[Solved]" to its heading once a solution to your problem has been provided.
Re: Copy style to new sheet
OK, Ken, I'm going to play with this some more this morning. I have been playing with a project for a few weeks and it the purpose should have been laid out and planned at the beginning. Instead, I'm playing with Calc and trying to write macros and formulas like I used to in Lotus 1-2-3 to manipulate statistical data. I'm trying to find tutorials to do this with a data base eventually. The spread sheets are for analyzing my golf scores. The conditional formatting is to show a different background for each condition (birdie, par, bogey, double bogey, triple bogey, other). In a cell in my table I measure my score against par to achieve a number. I think I will need a separate formula for each cell if I use your formula. Correct?
OpenOffice 3.2 on Windows Vista
Re: Copy style to new sheet
Here's one with the conditional formatting.
Just a couple of notes:
1) The text in the style table has to match the style names exactly--no extra spaces; letter case is significant
2) You need separate keys for the total scores if you want them styled separately; they can share the style names, as in the sample
3) Recent versions of Calc do not work well with this kind of conditional formatting: it causes Calc to use a lot of extra processing power, enough to slow down the application response with menus and other actions. You can see it getting sluggish even with these few cells.
4) This kind of formatting also causes a problem with notes in the sheet: they won't pop up when the mouse is over a cell with a note.
There are bug reports for these, but who knows when/if it will get any attention. Can't be a very high priority.
Just a couple of notes:
1) The text in the style table has to match the style names exactly--no extra spaces; letter case is significant
2) You need separate keys for the total scores if you want them styled separately; they can share the style names, as in the sample
3) Recent versions of Calc do not work well with this kind of conditional formatting: it causes Calc to use a lot of extra processing power, enough to slow down the application response with menus and other actions. You can see it getting sluggish even with these few cells.
4) This kind of formatting also causes a problem with notes in the sheet: they won't pop up when the mouse is over a cell with a note.
There are bug reports for these, but who knows when/if it will get any attention. Can't be a very high priority.
- Attachments
-
- round4_acknak.ods
- (14.37 KiB) Downloaded 347 times
AOO4/LO5 • Linux • Fedora 23
-
- Volunteer
- Posts: 918
- Joined: Sun May 31, 2009 1:35 am
- Location: Sydney, Australia
Re: Copy style to new sheet
Similar to Acknak's.
Lookup tables on Sheet2 just in case the table on Sheet1 is only meant to be a visual legend. Ken Johnson
Lookup tables on Sheet2 just in case the table on Sheet1 is only meant to be a visual legend. Ken Johnson
AOO 4.1.3 on Ms Windows 10
Help improve this forum by clicking the EDIT button on your first post then adding "[Solved]" to its heading once a solution to your problem has been provided.
Help improve this forum by clicking the EDIT button on your first post then adding "[Solved]" to its heading once a solution to your problem has been provided.
Re: Copy style to new sheet (solved)
It took a while for me to conform, but I finally used a combination of the formulas from you both. Thanks very much!
OpenOffice 3.2 on Windows Vista
Re: [Solved] Copy style to new sheet
It seems that the re-evaluation-that-sucks-cpu problem does not exist anymore or not in Linux anyway.
LibreOffice 3.4.x on (several) Linux.
LibreOffice 3.4.x on (several) Linux.
LibreOffice 3.4.x @ Linux (Mint, Ubuntu, openSuSE)