Set unit of cell format from another cell

Hi!

I would like to customize the unit of a cell, using the format feature of libre office calc, but I would like to use the value of another cell as the unit.

For example, let’s say I have the cell A1 with the text “meter” inside, and cell A2 with text “m3”.

In cell B1, I would like to reference cell A1 as the unit, and B2 the unit written in A2.

Of course the goal is to be able to expand those cells to do the same with A3, B3 and so one.

The reason I want to do that is I want the user to select the unit in a drop down list of pre established unit values.

Any clues on how to achieve that?

Thanks!

I would like to customize the unit of a cell, using the format feature of libre office calc,

The “unit” is a cell content. Nothing to do with the format feature.
.
Try to use a small helper table with the the Names and Units. Then use the function VLOOKUP() for search the unit based on the Name.
The list of the dropdown list (Data Validity) must be referenced to the Names.

Can you give us a list of the names and the assigned units, what you want to use?

In this case unit is NOT cell content, and AFAIK it IS related to format feature of libre office.

For example you can tell libre office Calc that a cell contains currency and you will get a $ sign in front of each cell without having to type it IN the cell.

More details and screenshots can be found here: https://www.libreofficehelp.com/format-cells-libreoffice-calc/

I want the “Format code” field of format dialog to be customizable with a “reference” to another cell.

For example I would be able to have format code.like this

“###.#### [A1]”

So in the case the user enter the number 9.89 in the cell and the content of cell A1 is “gallons”, the final display would be:

“9.89 gallons”

Of course this would be expandable

Do not use that feature, if you want to do it dynamically.
Put the units into the next cell, or concatenate the value and the unit (if the “textual result” not needed for other calculations) in one cell…

Not sure if usefull in your usecase, but you can create cell styles (one for each unit) that can be applied from the sidebar.
imagen