Function Domains/Conditional Formatting

I have two questions about LibreOffice Calc:

  1. Is there a way to set a variable domain for a function? For example, if I want a function to find the median of all the values in a column, how can I get the function to adjust its domain automatically whenever I add a new piece of data to the column? I want to avoid having to change the function from =MEDIAN(B1:B10) to =MEDIAN(B1:B11) (and so on) every time I add a row. Better yet, is there a way to set the domain to “every cell within the column that contains a value”?

  2. If I have a set of reference data in row 1 and actual data in rows 2–10, is it possible to use conditional formatting to set a different formatting style for each cell in rows 2–10 based on the relationship of each piece of data to the reference data in row 1? I’m not sure how to explain this concisely.

You can set up the range as long as you like, empty cells are not part of the calculation.
or set up Menu/Tools/Options/LibreOffice calc/General - Expand references when new columns/rows are inserted