Forum Discussion
teddi131
Sep 22, 2022Copper Contributor
Conditional Formatting - positional
Is it possible to create a conditional formatting rule that applies a format based on the position of the cell? For example - I'd like to apply a format to a cell if the cell is in the first row or t...
teddi131
Sep 22, 2022Copper Contributor
Sure, thank you for your help!
So imagine I have 2 different sheets with different sizes of data like -
This one has 4 columns and 11 rows. I ultimately want a border around the whole thing.
username | location | age | favorite color |
mb123 | LA | 5 | purple |
loz2023 | CA | 6 | red |
link45 | NY | 7 | pink |
batman | NM | 15 | orange |
daisy | FL | 20 | blue |
mb1234 | LA | 25 | red |
loz20234 | CA | 26 | yellow |
link454 | NY | 27 | green |
batman43 | NM | 25 | purple |
daisy56 | FL | 30 | blue |
This one has 3 columns and 6 rows and I want a border around it as well.
username | location | age |
mb123 | LA | 5 |
loz2023 | CA | 6 |
link45 | NY | 7 |
batman | NM | 15 |
daisy | FL | 20 |
This is a very simplistic example of what I'm trying to do. Ultimately I won't know what the data looks like since it's coming from others, but I want to create conditional formatting that will style it with a border around the table correctly no matter the size of the table (# rows/ # columns). I am writing code to do this and I will know the range of data. I can do this cell by cell, but was hoping to be able to do it with 1 formula that would apply to all cells.
Juliano-Petrukio
Sep 22, 2022Bronze Contributor
- teddi131Sep 23, 2022Copper ContributorThat works if I want all cells that aren't blank to be styled the same way but I really need to know the position of the cell because the styling will be different based on that. I think I can use something like OFFSET in my formula since I know the size of the table and should be able to add the correct arguments.