[Solved] Need help with a formula, function or macro

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
imdumb
Posts: 29
Joined: Wed Oct 04, 2017 3:31 am

[Solved] Need help with a formula, function or macro

Post by imdumb »

Hi

Don't know if this calls for a formula, function or macro, but I'm looking for a little help on this.

I have columns A and B in this example, that look something like this:

.....A....B
1...1.....1
2...1.....1
3...1.....1
4...1.....0
5...1.....3
6...2.....0
7...2.....2
8...2.....2
9...2.....0
10..2.....0
11..3.....0
12..3.....0
13..3.....4
14..3.....1
15..3.....2

I want to add up the numbers in Column B and get three results, one for the 1's in column A (or 1+1+3=6), one for the 2's in column B (or 2+2=4) and one for the 3's In column B (4+1+2=7), so that the results basically end up looking
something like this:

......A.....B
16...1......6 (you know, the sum of B1:B5)
17...2......4
18...3......7

(The actual columns would have about 500 rows and column A would have about 40 numbers, so I'd need a sum total for each of those 40 numbers ).

Have any ideas on how to do this? Thanks!
Last edited by imdumb on Fri Oct 27, 2017 7:15 am, edited 1 time in total.
open office 4.1.2, windows 7
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Need help with a formula, function or macro

Post by Villeroy »

Insert a first row as column headers, say A and B
Select the entire list or a single cell within
Data>Pivot Table>Create...
[X] Current Selection
Drag "A" into the "Row Fields" box.
Drag "B" into the "Data Fields" box.
[OK]
https://wiki.openoffice.org/wiki/Docume ... /DataPilot
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
imdumb
Posts: 29
Joined: Wed Oct 04, 2017 3:31 am

Re: Need help with a formula, function or macro

Post by imdumb »

Solved!

Such a hard problem with such an easy solution. If you know how to do it. Or run into someone who does.

Thanks for helping me again. You guys make this place great!
open office 4.1.2, windows 7
Post Reply