[Solved] Determine signed arithmetic difference of two cells

Discuss the spreadsheet application
Locked
User avatar
RMRavik
Posts: 9
Joined: Sun Nov 24, 2024 6:46 pm
Location: Aberdeen, Washington

[Solved] Determine signed arithmetic difference of two cells

Post by RMRavik »

=IF(B3>B6,B3-B6,B6-B3) B3 is smaller
=IF(C3>C6,C3-C6,C6-C3) C3 is larger
When ?3 is larger I want # to be negative
When ?6 is larger I want # to be positive
Both are negative
If I change > to < both are positive
I hope this makes sense
thanks

 Edit: Changed subject, was I'm not understanding how to get results I want 
Make your post understandable by others 
-- MrProgrammer, forum moderator 
Last edited by MrProgrammer on Fri Dec 05, 2025 7:02 pm, edited 4 times in total.
Reason: Tagged ✓ [Solved]
Open Office 4.1.14 - Windows 11, 64
User avatar
MrProgrammer
Moderator
Posts: 5468
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: I'm not understanding how to get results I want

Post by MrProgrammer »

RMRavik wrote: Thu Dec 04, 2025 5:22 am When ?3 is larger I want # to be negative
When ?6 is larger I want # to be positive
Just subtract!
=B6-B3
=C6-C3


If you need any additional assistance attach a spreadsheet demonstrating the difficulty (remove confidential information then use Post Reply, not Quick Reply, and don't attach a picture instead of the spreadsheet itself). I will not help further unless you attach a spreadsheet document.

If this solved your problem please go to your first post use the Edit ✏️ button and add [Solved] to the start of the Subject field. Select the green checkmark icon at the same time.

[Tutorial] Ten concepts that every Calc user should know
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.7.8, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
FJCC
Moderator
Posts: 9640
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: I'm not understanding how to get results I want

Post by FJCC »

Maybe I'm misunderstanding you. Wouldn't

Code: Select all

=B6 - B3
give you what you want? If B3 is larger, the result will be negative, and if B6 is larger, the result will be positive.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
User avatar
Zizi64
Volunteer
Posts: 11511
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: I'm not understanding how to get results I want

Post by Zizi64 »

Something is missing
Your ODF type sample file is missing. Please upload it here.
Tibor Kovacs, Hungary; LO7.5.8/25.8.5.2 /Win7-10-11 x64Prof.
PortableApps: LO3.3.0-25.8.5.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Lupp
Volunteer
Posts: 3761
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: I'm not understanding how to get results I want

Post by Lupp »

See attached example. It contains explanations.
aOO_113230_sign_of_difference.ods
(14.92 KiB) Downloaded 209 times
(Excuse: I'm a retired teacher.)
On Windows 10: LibreOffice 25.8.4 and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
User avatar
RMRavik
Posts: 9
Joined: Sun Nov 24, 2024 6:46 pm
Location: Aberdeen, Washington

Re: I'm not understanding how to get results I want

Post by RMRavik »

Your ODF type sample file is missing. What is ODF type sample file?

Please upload it here.How would I upload it?
Open Office 4.1.14 - Windows 11, 64
User avatar
Lupp
Volunteer
Posts: 3761
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: I'm not understanding how to get results I want

Post by Lupp »

RMRavik wrote: Thu Dec 04, 2025 3:57 pm Your ODF type sample file is missing. What is ODF type sample file?
ODF-type file is in this case a file wich you made with AOO and saved under a name with the extension .ods (roughly meaning Calc).
Please upload it here.
RMRavik wrote: Thu Dec 04, 2025 3:57 pm How would I upload it?
Switch to the "Full Editor" by clicking on the respective button below the editor for simple answers.
A bit below the new editing window you will now find a tab "Attachments". Use it and see.

An updated demo by Lupp you find here:
aOO_113230_sign_of_difference_2.ods
(20.74 KiB) Downloaded 122 times
On Windows 10: LibreOffice 25.8.4 and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
User avatar
RMRavik
Posts: 9
Joined: Sun Nov 24, 2024 6:46 pm
Location: Aberdeen, Washington

Re: Determine signed arithmetic difference of two cells

Post by RMRavik »

I want the profit - Loss to be B = Negative and C = Positive
Attachments
Untitled 1.ods
(10.9 KiB) Downloaded 116 times
Open Office 4.1.14 - Windows 11, 64
FJCC
Moderator
Posts: 9640
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Determine signed arithmetic difference of two cells

Post by FJCC »

Here is a revised version of your document. Formulas like =B6-B3 do what you want.
Attachments
Untitled_fjcc.ods
(10.93 KiB) Downloaded 100 times
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
User avatar
RMRavik
Posts: 9
Joined: Sun Nov 24, 2024 6:46 pm
Location: Aberdeen, Washington

Re: I'm not understanding how to get results I want

Post by RMRavik »

Zizi64 wrote: Thu Dec 04, 2025 8:06 am
Something is missing
Your ODF type sample file is missing. Please upload it here.
I uploaded this once but to another conversation.
Note: I failed to mention that the Today Price changes daily that's why I used the IF function
Attachments
Untitled 1.ods
(10.9 KiB) Downloaded 112 times
Open Office 4.1.14 - Windows 11, 64
FJCC
Moderator
Posts: 9640
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Determine signed arithmetic difference of two cells

Post by FJCC »

RMRavik wrote: Fri Dec 05, 2025 3:10 pm Note: I failed to mention that the Today Price changes daily that's why I used the IF function
I don't understand how an IF() function is useful here. The formulas I used in B7 and C7 will update the calculation whenever the Today Price changes. Please explain why the calculations in the file I posted do not meet your needs.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Locked