Excel formatting query
Discussion
Hi folks,
I currently have an excel problem I need to solve at work involving conditional formatting.let me explain.
I have the values, 2D, 2C,2S,3D,3C and 3S. This is the correct order of importance from lowest to highest in terms of value. I am looking to conditionally format the value in the next adjacent cell if it is higher and lower than the previous cell, ie the cell turns red if 2C is in say cell A1 and 2D is entered into cell A2. And green if a higher value is entered etc.
I can’t get conditional formatting to work properly because the contents of the cell are numbers and text ie 2C and I can’t seem to find a way to tell excel that 2C is greater than 2D and so on. Hopefully someone is reading this that uses excel daily and can help solve my problem!
I currently have an excel problem I need to solve at work involving conditional formatting.let me explain.
I have the values, 2D, 2C,2S,3D,3C and 3S. This is the correct order of importance from lowest to highest in terms of value. I am looking to conditionally format the value in the next adjacent cell if it is higher and lower than the previous cell, ie the cell turns red if 2C is in say cell A1 and 2D is entered into cell A2. And green if a higher value is entered etc.
I can’t get conditional formatting to work properly because the contents of the cell are numbers and text ie 2C and I can’t seem to find a way to tell excel that 2C is greater than 2D and so on. Hopefully someone is reading this that uses excel daily and can help solve my problem!
An easy way would be to make a table of the 2C, 2D etc with a value assigned to them that matches their hierarchical value. Then have a vlookup column that gives this value and then a column that use a IF function for the row below being higher/lower, this can then be the basis for a conditional format using the formula function and IF.


Edited by anonymous-user on Thursday 25th January 20:19
I would do something like this, split the numbers up, give the letters a value (using column and indirect), then sum up the two, simples:

Result:

So the number are the hundreds, while the decimal and single digits are for the letter (A=1, B=2).
Short version:

=LEFT(D4;1)*100+COLUMN(INDIRECT(RIGHT(D4;1)&1))
Result:
So the number are the hundreds, while the decimal and single digits are for the letter (A=1, B=2).
Short version:
=LEFT(D4;1)*100+COLUMN(INDIRECT(RIGHT(D4;1)&1))
Edited by ZesPak on Thursday 25th January 20:04
If that is the entire fixed list of values that you are comparing, you could probably do something in a conditional formatting formula that compares LEFT(cell) in ascending order then RIGHT(CODE(RIGHT(cell))) in descending order, as the ASCII values for D,C,S are 68, 67 and 83 respectively
Very hacky and fragile though
Very hacky and fragile though
ZesPak said:
I would do something like this, split the numbers up, give the letters a value (using column and indirect), then sum up the two, simples:

Result:

So the number are the hundreds, while the decimal and single digits are for the letter (A=1, B=2).
Short version:

=LEFT(D4;1)*100+COLUMN(INDIRECT(RIGHT(D4;1)&1))
Go easy if you're using INDIRECT, as a volatile function it doesn't scale well. Fine in a few instances, but if you've got a couple of hundred rows or more, all running INDIRECT, it can start to have an impact. Result:
So the number are the hundreds, while the decimal and single digits are for the letter (A=1, B=2).
Short version:
=LEFT(D4;1)*100+COLUMN(INDIRECT(RIGHT(D4;1)&1))
Edited by ZesPak on Thursday 25th January 20:04
weeboot said:
Go easy if you're using INDIRECT, as a volatile function it doesn't scale well. Fine in a few instances, but if you've got a couple of hundred rows or more, all running INDIRECT, it can start to have an impact.
Pah, scales pretty good on current day machines.Not nearly as often used as Today() or Now() either, both volatiles as well.
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff


