Matching conditional formatting in adjacent cells with Excel 2013

1,992

Solution 1

You don't need to resort to R1C1 notation to do this. It can just as easily be done with the A1 notation.

In your question you mention columns A and B, but in later comments you mention columns B and C. Let's assume the data is in columns A and B, as stated in your question. You can adapt the solution to other locations, of course.

Select both cells, A5 and B5. Create a new conditional format with a rule. Enter this formula

=Left($A5, 1)="*"

Select a format and close all dialogs. This formula will check the value in column A and if the value starts with a * sign, it will apply the format to all cells in the row that were selected when the format was defined.

You can apply the same conditional format to other rows. Here are three different ways to do that:

  • Copy cells A5:B5, then select the target rows and use Paste Special > Formats

  • Select A5 or B5, use Conditional formatting > Manage formats. Change the range that the format applies to.

  • When you apply the conditional format, select not just one row, but all rows that you want to use this format for. The formula will always look at column A, but will use the data in the same row. Just make sure that the row number is the same as the row number of the active cell.

The A1 notation uses the $ sign to mark an absolute reference. Absolute references will refer to the exact same cell when a formula is copied down or across (or when a conditional formatting is copied down or across). A formula like =$A1 will always refer to column A, since the $ sign makes the column reference absolute and not relative to the current cell. A formula like =A$1 will always refer to row 1 and the formula =$A$1 will always refer to cell A1.

Solution 2

If you switch Excel to R1C1 mode, you will find this kind of thing a lot easier to get your head around!

Select both columns and apply the same formatting rule to both using a custom rule something like:

=LEFT(RC2, 1)="*"

That way, for every row, column 2 (B) is checked for the specific text and if it matches, the format will be applied to both columns.

You can do this using the normal cell references as well but I find R1C1 much easier to work with.

Share:
1,992

Related videos on Youtube

limak111
Author by

limak111

Updated on September 18, 2022

Comments

  • limak111
    limak111 over 1 year

    Based on multiple thread regarding topic "'application/x-www-form-urlencoded' not working with @RequestBody" I haven't been successful in finding a solution for WebFlux Spring application.

    I have a WebFlux Controller method:

        @PostMapping(value = "/endpoint", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
            public Mono<AddRecipientResponse> createRecipient(@RequestBody
                                                      final MultiValueMap<String, String> formData,
                                                      @RequestHeader
                                                      final Map<String, String> headers) {
    

    But when I post my reqest I'm getting this error:

    Could not resolve parameter [0] ... RecipientController.createRecipient(long,org.springframework.util.MultiValueMap<java.lang.String, java.lang.String>,java.util.Map<java.lang.String, java.lang.String>): 415 UNSUPPORTED_MEDIA_TYPE
    

    Most of the solution rely on replacing @RequestBody with @RequestParam. However this cannot apply for my case. I need to have both @RequestBody and consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE. I tried following steps described in following threads, but off of them are for Spring MVC.

    https://stackoverflow.com/a/70148328/18734587

    https://stackoverflow.com/a/51160620/18734587

    Have anyone figured out how to solve 415 UNSUPPORTED_MEDIA_TYPE error for a request with MediaType.APPLICATION_FORM_URLENCODED and @RequestBody for a WebFlux application?

  • Duggles
    Duggles about 10 years
    I understand what you did, but that is not what I'm trying to accomplish; cell B5 contains text. When that text begins with an asterisk (*) the text font of cell B5 becomes bold and blue. When this condition is met in cell B5, I want the content (font) of cell C5 to also become bold and blue. The content of cell C5 is a quantity (numeric).
  • Julian Knight
    Julian Knight about 10 years
    Hi, not a problem. I've updated the formula. Remember, you need to apply that formatting formula to BOTH columns