[Solved] Applying style from 1 sheet to another for dropdown

Discuss the spreadsheet application
Post Reply
Jul
Posts: 2
Joined: Tue Sep 21, 2021 5:29 pm

[Solved] Applying style from 1 sheet to another for dropdown

Post by Jul »

Hi guys,
I've been trying all afternoon to get this done and I searched numerous ways to do it on the forum.

I have numerous sheets which I use as Lookups. Of which, certain rows have different styles applied to them (this is so that I avoid having to create extra, repeated columns in each sheet).

Then I have a sheet which will use the data in other sheets as drop-downs - this part is straight-forward. However, I would like it that whenever i select an option, if the associated row in the lookup table/sheet has formatting, the formatting will be applied to the cell where the drop-down is in.

I have created styles for each type of formatting, and to my knowledge, applied them to each row/cells respectively. Styles include changes to font color, family, size, alignment and wrap-text.

To bring this together, I have done Conditional Formatting, using Formula is, with the formula;

Code: Select all

STYLE(VLOOKUP(B2; $Heads.$A$2:$B$16; 2; 0))
Where;
  1. B2 is the drop-down cell,
  2. the cells inside the Heads sheet is the data-table,
  3. the 2nd column is the where I want to read the style from.
However;
  1. I notice no styles listed in the Applied Styles menu (F11 -> Applied Styles) after having repeatedly selected cells and double-clicked the style to apply (even used Fill, but no effect).
  2. Selecting cells to have Default Formatting does nothing.
I have attached my document - it's a spreadsheet about items in a PS1 game so no confidential info to worry about.

If I may be so bold, What's the issue? Can anyone shed some light on what I'm doing wrong?

Things that helped me in my research;
  1. VLOOKUP tutorial helping me understand parameters in VLOOKUP viewtopic.php?f=75&t=46746
  2. A sample document from a thread that is lost to me right now but showed me it's possible - I have provided it as reference.
  3. FJCC explaining STYLE() looks for existing styles applied to cells viewtopic.php?f=9&t=100581&p=484157&hil ... up#p484166
Attachments
Armored Core parts.ods
my document
(43.11 KiB) Downloaded 108 times
Validity and Cond Format.ods
sample file I found on the forum which showed me it was possible to do what I have in mind
(8.43 KiB) Downloaded 101 times
Last edited by Jul on Wed Sep 22, 2021 11:28 pm, edited 1 time in total.
OpenOffice 4.1.3 on Win 10
FJCC
Moderator
Posts: 9274
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Applying style from one sheet to another for a drop-down

Post by FJCC »

The VLOOKUP in the formula

Code: Select all

STYLE(VLOOKUP(B2; $Heads.$A$2:$B$16; 2; 0))
is looking for the value HD-GRY-NX in the table $Heads.$A$2:$B$16 and the returned value is HD-GRY-NX. You are trying to execute STYLE("HD-GRY-NX"). But there is no style named HD-GRY-NX. If you set up a style with that name, it will be applied to the cell.
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.
Jul
Posts: 2
Joined: Tue Sep 21, 2021 5:29 pm

Re: Applying style from one sheet to another for a drop-down

Post by Jul »

FJCC wrote:The VLOOKUP in the formula
...
is looking for the value HD-GRY-NX in the table $Heads.$A$2:$B$16 and the returned value is HD-GRY-NX. You are trying to execute STYLE("HD-GRY-NX"). But there is no style named HD-GRY-NX. If you set up a style with that name, it will be applied to the cell.
This explains it.

I added an extra column with the respective style made the conditional formatting read the style from this new column and it works as I wanted it. :)

Thanks! Marking as Solved.
OpenOffice 4.1.3 on Win 10
Post Reply