IF + Conditional formatting

How do I accomplish this task?

Suppose I have 1 reference cell R1, and I have 2 columns, C and D, just to make it simple, let’s assume it has only 3 rows,
C1=<5, C2=5-10, C3>10, if my R1 is 6, then I’d like to put a mark (O for instance) in D2, with background yellow, but if my R1 is 3, then D1 should have O with yellow color. My initial thought is having an IF on D column to test the values and put an O, and then conditional formatting to change the yellow background, I’m still learning CF (Conditional Formatting), so not sure how to accomplish this. can someone please point me to the right direction? Or is there any tutorial explaining details of CF?
ps: I’ve attached an example with 5 rows to show what I’d like to accomplish.15943082546679422.ods

Why did you put your O into C7, while your description doesn’t tell about what to happen if the reference is 16. From my perspective it looks a bit you want the row describing the range into which the value of your reference cell falls into having an O (in colum C if Male / in column D if Female).

Sorry Opaque, the description above is different from the spreadsheet, I used a short description to simplify my explanation, and I’m afraid that I made it worse.

Hello,

See the following extension of the file I’ve provided with the answer to your last question: ConditionalMaleFemale+IF.ods

Now test using drop down in A2, which only handles the two cases (3 and 6) of your description. Formlual in
C2: =IF(A2=3;"O";"")
D2: =IF(A2=6;"O";"")

And there is an additional Conditional Formatting for Range C2:D2.

Hope that helps.

Thanks Opaque again for your help, I tried to use Formula is = C$2:D$2="O", doesn’t work, why? What’s the difference?
Maybe Formula is only can test single cell?

Common problem to understand how Conditional Fomatting internally works for ranges: You never need to specify the range in a formula but the formula for the upper left corner cell of a range.

Condition 1: Formula is C2="O" Range C2:D2

The Conditional Formatting algorithm assures, that the formula is adapted for each cell of the defined range (here: C2:D2). Though you defined the rule only once (for the upper left corner cell of the range, internally the following happens:

  • Ah - have to condiitional format C2:D2, lets start with C2 (upper left corner)
  • Check the rule C2="O" and do the required formatting, if rule yields true
  • Move to D2 (next cell of the range)
  • adapt the rule to D2="O"
  • Check the adapted rule D2="O" and do the required formatting, if rule yields true

Thanks so much for this detailed explanation, now it’s clear.