I have 9 items in my table. I am trying to do "Unit" * "Price" for every each items. And that work fine.
-------------------------------------------------------------------------------
My formula is
unit1 * 1price = 1Total
unit2 * 2price = 2Total
unit3 * 3price = 3Total
unit4 * 4price = 4Total
I tried this way to get the total of all of them. But it doesn't work.
This is what I did
1Total + 2Total + 3Total + 4Total nor
(unit1 * 1price)+(unit2 * 2price)+(unit3 * 3price)+(unit4 * 4price).
Please tell me how can I get the total price of all of them?
Title Edited. A descriptive title for posts helps others who are searching for solutions and increases the chances of a reply (Hagar, Moderator).
Calculating Formula (totaling several results)
Calculating Formula (totaling several results)
OpenOffice 4.1.5 on Windows 10
-
- Volunteer
- Posts: 1544
- Joined: Wed Jun 24, 2015 12:56 am
- Location: Colorado, USA
Re: Please Help Me With Calculating Formula
If each row in your table has a Unit column and a Price column then
Sum("Unit" * "Price")
should get the value you want.
Sum("Unit" * "Price")
should get the value you want.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Re: Please Help Me With Calculating Formula
If the suggestion from UnklDonald418 doesn't help you, please tell us exactly how your formula doesn't work.
- What do you see in the cell?
How does your results look?
What formulas do you use? (Please paste the exact formulas you have inyour cells, not the pseudo formulas you have given.)
Re: Please Help Me With Calculating Formula
That formula works on each item. But I can't get the total of 9 items.UnklDonald418 wrote:If each row in your table has a Unit column and a Price column then
Sum("Unit" * "Price")
should get the value you want.
OpenOffice 4.1.5 on Windows 10
-
- Volunteer
- Posts: 1544
- Joined: Wed Jun 24, 2015 12:56 am
- Location: Colorado, USA
Re: Calculating Formula (totaling several results)
If your table is in a Base database, the query would look like this.
Code: Select all
SELECT SUM("Unit" * "Price") AS "Total" FROM "Your table name goes here"
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Re: Calculating Formula (totaling several results)
Sorry, I picked this up from new post and didn't notice that it was in Base. I was thinking Calc.
To create a sum in Base, you use the aggregate function SUM.
In design view, enter Unit*Price in the field cell, and select function Sum below.
In SQL view, enter this (assuming the name of your table is "entries":
Edit: Looks like UnklDonald418 made the same discovery. |
In design view, enter Unit*Price in the field cell, and select function Sum below.
In SQL view, enter this (assuming the name of your table is "entries":
Code: Select all
SELECT SUM( "units" * "price" ) FROM "entries"
Edit: UnklDonald's as "Total" gives a cleaner heading to the result, which is good! |