More Excel Help...
 

  You don't need to be an 'investor' to invest in Singletrack: 6 days left: 95% of target - Find out more

[Closed] More Excel Help...

7 Posts
5 Users
0 Reactions
48 Views
Posts: 7169
Full Member
Topic starter
 

I have a table in Excel which is the result of an SQL query (which has a parameter that can change)

E.g.

Columns A, B, C, D

Sorted on Column D.

I would like to colour in each row based on the value in Column A.

[b]A B C D [/b]
c x x 1
d y y 1
c z z 2
e a a 2

So, rows 1 & 3 to have the same colour, and rows 2 & 4 to have their own colours.

I could do it with a bunch of conditional formatting rules, but it would have to be redone each time the table was refreshed.

Anybody got any bright ideas?


 
Posted : 24/03/2017 5:09 pm
Posts: 36
Free Member
 

probably solvable with NAMED RANGES.
ALthough why not just conditional formatting? Have you got loads of options in A?


 
Posted : 24/03/2017 5:15 pm
Posts: 7169
Full Member
Topic starter
 

Yes, loads of potential values in A.

Will conditional formatting stick around if I refresh the table? I wouldn't mind (too much) doing it once if it stuck...


 
Posted : 24/03/2017 5:17 pm
Posts: 36
Free Member
 

yes, conditional formatting is a format characteristic, so assuming the sql population is data only (or referenced) it shouldnt change any formats


 
Posted : 24/03/2017 5:18 pm
Posts: 7169
Full Member
Topic starter
 

Cheers. Job for Monday 🙂


 
Posted : 24/03/2017 5:20 pm
Posts: 0
Free Member
 

Either that or vba to create a function for the sheet. It was beyond my abilities. Might have an example at work but can't promise


 
Posted : 24/03/2017 6:31 pm
 poly
Posts: 8699
Free Member
 

Be aware that there is an upper limit to the number of formats you can apply (changed with version of Excel too, to make it hard to predict!)


 
Posted : 24/03/2017 6:42 pm
Posts: 0
Full Member
 

When they "improved" the conditional formatting function a few generations ago, they made it harder to manage, IMO. It always seems to create a gazillion separate rules to replace the one you create for a range. And it can go really screwy if you sort or move things around.

I'd favour a VBA approach here.


 
Posted : 24/03/2017 8:14 pm

6 DAYS LEFT
We are currently at 95% of our target!