Ask Your Question
0

Cell Calculation

asked 2015-03-13 19:47:48 +0200

thes4s gravatar image

I am using LibreOffice Calc to set up my store's inventory. In one column, I have a "Price" column. Is it possible to format the cells in that column to calculate "price" instantly? Let me explain this more, so for example in a cell on the "Price" column, I enter in 20, it would then change that to 55. The change is based on a formula for margin increase. I am aware that I can do this if I create another column and put the wholesale price of 20 there and use the Price column to calculate the margin increase of the wholesale price, however in my circumstance, I can't because this is a spreadsheet to be uploaded.

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2015-03-14 17:13:28 +0200

m.a.riosv gravatar image

Using paste special:

a) Put the value to use for update the values in a cell.
b) Copy that cell.
c) Select the range to modify. d) Menu/Edit Paste special [Shift+Ctrl+V]
e) Select the operation to apply.
Ok.

edit flag offensive delete link more
0

answered 2015-03-14 08:05:32 +0200

pierre-yves samyn gravatar image

updated 2015-03-14 08:09:00 +0200

Hi

I do not understand why the fact that the spreadsheet is uploaded prevents add a calculation column. However, to answer the question, I do not think there is solution without macro. The macro can be associated with the event Content changed: Right click sheet tab > Sheets Events. Note: this depends on the authorization of the execution of macros. This solution is not necessarily better than the addition of a calculation column. May I add that, as a user, I would hate not to see what I entered :)

AutoCalc.ods

Code Sample (the number of the column to be treated is declared "constant" at the beginning. Warning: Column A has the number zero. In Example 3 refers to the column D):

const NumCol=3

Sub PysAutoCalc(oEvent)
' If the changed item is a cell'
if oEvent.supportsService("com.sun.star.sheet.SheetCell") then
' If it is in the column'
    if oEvent.CellAddress.column = NumCol then
' If it is a value'
        if oEvent.Type = com.sun.star.table.CellContentType.VALUE then
' do some stuff...'
                oEvent.value = oEvent.value * 1.1
        end if
    end if
end if
End Sub
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2015-03-13 19:47:48 +0200

Seen: 398 times

Last updated: Mar 14 '15