Libreoffice speadsheet help

lindabea
lindabea Posts: 1,513 Forumite
Part of the Furniture 1,000 Posts Name Dropper
HI Guys, need some help with spreadsheet formula please. I want to put a value in B3, IF (B1>B2,B1). But here's the problem... works fine if B1>B2, but if the condition is false, I get 0 in B3. What I want is if the condition is false, B3 should not be updated. Any clever ideas please
Before doing something... do nothing
«13

Comments

  • Maybe: =IF(B1>B2,B1,"")
  • lindabea
    lindabea Posts: 1,513 Forumite
    Part of the Furniture 1,000 Posts Name Dropper
    Maybe: =IF(B1>B2,B1,"")

    Thanks for your suggestion, but it inserts a blank instead of zero. Back to the board
    Before doing something... do nothing
  • Paul_DNAP
    Paul_DNAP Posts: 751 Forumite
    500 Posts Second Anniversary Photogenic Rampant Recycler
    What do you want B3 to show instead of the zero or the blank?
    (Although I could be wrong, I often am.)
  • mksysb
    mksysb Posts: 401 Forumite
    Eighth Anniversary 100 Posts Photogenic Name Dropper
    There can't have been anything originally in B3 if you are replacing it with the formula. What are you expecting to be there? May be you could do something like
    =IF(B1>B2,B1,"Value you expect")
  • Paul_DNAP
    Paul_DNAP Posts: 751 Forumite
    500 Posts Second Anniversary Photogenic Rampant Recycler
    Or do you mean "There is already a value entered manually in B3, but you want it to be replaced by the value in B1 if B1 is greater than B2, but to remain with the value that you entered if B1 is equal or less than B2" - then this is indeed a lot more difficult.
    That's because any formula you enter in there to do the B1<B2 will replace what is entered/typed in there already, you could do it if you're clever with macros and scripting.


    I would suggest bringing B4 into play to be the results cell. B4 being =IF(B1>B2,B1,B3) that will leave all the original data untouched and still display the result you want (if indeed that is what you were wanting).
    (Although I could be wrong, I often am.)
  • Cornucopia
    Cornucopia Posts: 16,435 Forumite
    Part of the Furniture 10,000 Posts Name Dropper Photogenic
    I suspect that what the OP wants to do is impossible without scripting.

    The use of formulas in spreadsheets works in a fundamentally different way to that imagined in the requirement expressed.

    The content of B3 IS the formula concerned. What is seen is the evaluation of that formula. There is no "previous content" of the cell, it has gone as soon as the formula has been placed there.
  • lindabea
    lindabea Posts: 1,513 Forumite
    Part of the Furniture 1,000 Posts Name Dropper
    Paul_DNAP wrote: »
    What do you want B3 to show instead of the zero or the blank?

    I want B3 to show B1 - but only if B1 is >B2. B3 may already contain a previous value when the condition was true.
    Before doing something... do nothing
  • lindabea
    lindabea Posts: 1,513 Forumite
    Part of the Furniture 1,000 Posts Name Dropper
    Paul_DNAP wrote: »
    Or do you mean "There is already a value entered manually in B3, but you want it to be replaced by the value in B1 if B1 is greater than B2, but to remain with the value that you entered if B1 is equal or less than B2" - then this is indeed a lot more difficult.
    That's because any formula you enter in there to do the B1<B2 will replace what is entered/typed in there already, you could do it if you're clever with macros and scripting.


    I would suggest bringing B4 into play to be the results cell. B4 being =IF(B1>B2,B1,B3) that will leave all the original data untouched and still display the result you want (if indeed that is what you were wanting).

    You're spot on about what I'm trying to do, but my knowledge does not stretch to using macros. I don't quite understand how using B4 as you suggest overcomes the problem. What happens when I need to change the value in B1 and is > B2. I want the new greater value in B1 retained in B3. Conversely, if I enter a lwoer value in B1, I do not want the previous value in B3 to change or indeed go to zero or blank.

    I'm not sure if using B4 solves the problem
    Before doing something... do nothing
  • Cornucopia
    Cornucopia Posts: 16,435 Forumite
    Part of the Furniture 10,000 Posts Name Dropper Photogenic
    edited 20 July 2018 at 1:13PM
    The IF function does not work in that way (cannot work in that way).

    =IF(condition,X,Y)

    The value placed in the cell will be X when the condition is true, and Y if the condition is false. The previous value of the cell is lost as soon as the formula is placed there.

    Paul_DNAP has it right, I think, in that you will need a fourth cell to hold the preserved value.

    You can try it the opposite way around to what he has suggested, and preserve the old value in B4, and then use:-

    =IF(B1>B2,B1,B4) in cell B3.

    But B4 will have to be the actual value that was previously in B3. It cannot be =B3, because that would create a circular reference.
  • Problem is with iterative calculation - following works in Excel but LibreOffice?
    Excel Options - Formulae - Enable Iterative Calculation - Maximum Iterations = 1.
    In B3 enter formula =IF(B1>B2,B1,B3).
This discussion has been closed.
Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

Categories

  • All Categories
  • 349.8K Banking & Borrowing
  • 252.6K Reduce Debt & Boost Income
  • 453K Spending & Discounts
  • 242.8K Work, Benefits & Business
  • 619.6K Mortgages, Homes & Bills
  • 176.4K Life & Family
  • 255.7K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16.1K Discuss & Feedback
  • 15.1K Coronavirus Support Boards

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.