My use of defined names may have confused you.

The objective is to develop formulae Is_K? and Is_Y? that can be evaluated within each cell of your grid and determine whether a conditional format is active or not (in the attached, I have evaluated Is_K? in the cell as well as evaluating it as a conditional format criterion).

A key element of the formula is

= ( MEDIAN( K Offset.range, offset ) = offset )
I have used two names to identify the (vertical) bounds on the quantity with reference name 'K'. One name is the row range 'K' and the other identifies the four values in the 'Offset' columns. The two ranges separated by a space is the intersection of the row and columns and evaluates to give

=$R$5:$S$5
The name 'offset' is a relative reference that looks up the current row label on the 'vertical' axis.

The MEDIAN function returns the middle value of a set of values. When there are three values comprising upper and lower bounds and a test value, the test value will be returned only if it is within the bounds. This gives a single test that replaces separate checks against the upper and lower bounds individually.

Multiplying the above formula by

*

( MEDIAN( K Chainage.range, Chainage ) = Chainage )
causes a 1 to be returned only if both the row and column are within range.

I hope this helps.