Hello!
I'm not very good with figuring out the formulas and I hope you guys can help me out!
I have columns with numbers I need added together, however the numbers have a slash in between them.
Example: 300/245
How do I get the sum to add each side of the slash separately and display it as: "Total Sum/Total Sum"
I hope this made sense.
Thank you!
-Ryan
[Solved] Add values with a slash
[Solved] Add values with a slash
Last edited by Ryan56k on Fri Feb 02, 2024 6:03 pm, edited 1 time in total.
OpenOffice 4.1.11 on windows 11
Re: Add values with a slash
If I understand you correctly, the easiest solution is to split the data into two columns. Select the cells and choose the menu item Data -> Text to Columns. Set the separator to Other and type / in the box next to that selection. Click OK and you will have two columns of data. At the beginning, the column next to your data should be empty. If it has data, click on its header, the letter giving its name, and then select Insert -> Columns to make a blank column.
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.
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Re: Add values with a slash
This actually does the opposite of what I want haha. I want it all in one column and then at the bottom of the one column I'd like it to add everything together and keep the format of "243/500". With the total of everything to the right of the slash being one value and everything to the left of the slash being one value.
OpenOffice 4.1.11 on windows 11
Re: Add values with a slash
Use the separate columns as FJCC suggests then put it back together in another column.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
Re: Add values with a slash
I understood what you want, it just seems like asking for trouble to process data like that.
This formula seem to work if there is text of the correct pattern in every cell in the range A1:A6.
This formula seem to work if there is text of the correct pattern in every cell in the range A1:A6.
Code: Select all
=SUMPRODUCT(VALUE(LEFT(A1:A6;SEARCH("/";A1:A6)-1))) & "/" & SUMPRODUCT(VALUE(RIGHT(A1:A6;LEN(A1:A6) - SEARCH("/";A1:A6))))
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.
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Re: Add values with a slash
This is perfect! Thank you very much for going to the trouble and writing that out for me.
OpenOffice 4.1.11 on windows 11
Re: [Solved] Add values with a slash
Or you can use the function SILLYSUM() as you can see in my attachment:
It is a macro function. You can imporove it for more error handling or more features.
Here is the code:
It is a macro function. You can imporove it for more error handling or more features.
Here is the code:
Code: Select all
REM ***** BASIC *****
Option Explicit
Function SillySum(aRangeValues as variant)
Dim Sum_0, Sum_1 as long
Dim lPart_0, lPart_1 as long
Dim sValue as variant
Dim aParts as variant
Sum_0 = 0
Sum_1 = 0
For each sValue in aRangeValues
if VarType(sValue) = V_STRING then
aParts() = Split(sValue,"/")
if ubound(aParts) > 1 then
SillySum = "More than two data in a cell"
exit function
else
Sum_0 = Sum_0 + val(aParts(0)
Sum_1 = Sum_1 + val(aParts(1)
end if
elseif VarType(sValue) = V_EMPTY then
' nothing to do
else
SillySum = "NotAStringError"
exit function
end if
next
SillySum = Sum_0 & "/" & Sum_1
end function
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.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.
PortableApps/winPenPack: LO3.3.0-7.6.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.