Episode: 2069
Title: HPR2069: Counting Stuff in LibreOffice Calc
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr2069/hpr2069.mp3
Transcribed: 2025-10-18 13:55:49

---

This is HPR Episode 2069 entitled, Counting Stuff in Libra Office Calc and in part of the series, Libra Office.
It is hosted by John Culp and is about 20 minutes long.
The summary is, I try to explain how to use the Counting Function in Libra Office to generate reports.
This episode of HPR is brought to you by an Honesthost.com.
Get 15% discount on all shared hosting with the offer code HPR15. That's HPR15.
Better web hosting that's honest and fair at An Honesthost.com.
Hey everybody, this is John Culp and left you at Louisiana recording another episode for Hacker Public Radio.
I'm going to try to get this done before I've got to do some work this morning.
It's summertime, so my schedule is not nearly so tight as it is during the long semesters.
So today's topic is something to do with Libra Office, so I reckon I'm going to put it in the Libra Office series.
This is something that I learned about when I first took over as director of the School of Music back in January.
The School of Music here, actually the School of Music and Performing Arts, is we have maybe 280 to 300 music and performing arts majors,
and I've got something like 60 faculty total who work underneath me for which I'm a supervisor.
One of the first things I did when I started the job back in January was to try to get all of the information about my faculty and students together in one place in an organized way so that I would know certain information about them.
These are things like basic information, like contact information by email and phone, physical addresses, and that information was available in some way.
I had to do some consolidation and stuff because it had been kind of haphazard the way this info was maintained before.
But then I also, as part of my, I started collecting this in a spreadsheet, and what I also wanted was information about them professionally, like the rank that they held, whether they had tenure yet or not, which faculty track there and we have tracks one through five, and it depends on how much teaching versus research you do.
And then I also wanted to know whether, like, what the highest degree earned the person had was and whether it was a terminal degree, what school they went to for it, what area they specialized in, whether they're a member of the graduate faculty, whether they're certified to teach online, whether they held professorships, lots and lots of different information.
And so that I would have all of this in one place and it would be easier to maintain.
Well, once I got the information entered in columns in my spreadsheet, I wanted to start generating reports that would tell me, like, how many faculty do I have who are at, say, the rank of associate professor, or how many faculty already have tenure, how many faculty have terminal degrees and stuff like this.
And so I found a little formula thing called Count If, Count If, COUNTIF, and it does what it sounds like, it counts something if it meets certain criteria.
And so in my spreadsheet, I created a new, so let's, what do they call it, a workbook, I guess, inside the workbook, there are different sheets.
So the first sheet in my faculty information workbook is just called Personnel.
And then I have another worksheet that's a bunch of pivot tables that have various other things.
A hookah talked about pivot tables in one of his episodes and that was very enlightening.
It's a very, very handy function of a spreadsheet.
I created a new tab called Reports, and when I speak of a tab here, I'm actually, it's another sheet, but it's inside the same workbook.
And in the Reports sheet, I have some reports.
So the first one is where I want to break down the faculty by their rank.
I have three columns here. The first one is rank, and I have several ranks, adjunct, instructor, master instructor, assistant professor, associate professor, and the highest rank is professor.
The next column over is the number of faculty who hold that rank, and then the third column is the percentage of the faculty who hold that rank.
And it's based on whatever number appears in the second column.
So the second column is where we can get into the Count If function.
So what I do is to do the Count If, you have to position the cursor in the cell where you want to start counting something, and then press the equals key, and that will get you into the formula bar.
And in this case, is this one of the ones? I have several examples in the show notes.
And so if you're interested in trying to learn how to do these things, you might want to follow along carefully with the show notes instead of just trying to listen to what I'm saying, because it can get a little confusing with all of the commas, colon, semicolons, dollar signs, and whatnot.
Let me see.
Personnel reports a six. Let me just take one sec to see. Yeah.
Okay, so the example that I have in the show notes, the first example counts how many faculty I have at the assistant professor rank.
And the way this is done is I position the cursor in the cell where I want to have the counting take place, press equals, and then count if in all caps.
And I don't know if this has to be in all caps or not. I've never tried it in lowercase, but all caps COUNTIF.
Open parenthesis, then dollar sign personnel, and personnel again is the name of the worksheet, or sorry, as the name of the sheet from which it's going to grab the data.
So this tells it to go look in the, in the sheet called personnel, and after we're personnel, there's a period.
And then you tell it what column and cell to start in. So I say, dollar sign personnel dot dollar sign K that says to go to column K, and then dollar sign one.
So that's, that means cell number one in column K, and then a colon followed by dollar sign K, dollar sign 135.
So that tells it to go in column K, look in cells one through 135. And then there is a comma followed by what it is that I want it to look for.
And in this case, I use the value of what is in cell A6 on the current sheet. And this sheet is called reports.
So I, after the comma, it says reports dot A6. So that will look on column K, cells one through 135 of the personnel sheet.
It will look for the string that exists in the sheet called reports in cell A6. And in this case, it's looking for the string assistant professor.
And it will just count every time that appears. And it happens to be seven. I've got seven assistant professors.
And so for each of the different ranks, I just substitute in the appropriate string to search for. I use the same column because that column K on my personnel worksheet spreadsheet is where I have the rank listed for every faculty member.
And so for adjuncts, I have, it's exactly the same formula except for its reports dot A3 at the very end. Then you have, at the end of the formula, you have to put a closed parenthesis or else it will mess up.
Anyway, again, if you're interested in really seeing this formula, look at the show notes, I encourage you to do that.
The next example I have in the show notes is one where instead of looking for a string that exists in a cell, you can state explicitly the string you want to look for.
And this one says account occurrences of the explicit string on the sheet personnel in column K. And the string I'm looking for in this case is instructor.
So the way the formula goes is equals, and then all caps, CO, UN, T, I, F, open parenthesis, dollar sign personnel dot dollar sign K, dollar sign one colon, dollar sign K, dollar sign 135, comma, open quote equals instructor, closed quote, closed parenthesis.
So that tells it to look on the sheet called personnel in column K sells one through 135 for the string that equals instructor.
And let me go back to the worksheet here. And I've got seven instructors as well.
What's the next one? So then there's another kind of count if where you can, the next example is to count the value, the numerical values that are greater than or equal to a certain number.
And so in my example, I say count the number of instances of a number greater than or equal to 50. So in this case, it looks like in this one, I'm looking on the current sheet rather than rather than on a different sheet.
So this says equals count if open parenthesis, dollar sign I, dollar sign two colon, dollar sign I, dollar sign 105, comma, open quote greater than equal 50, closed quote, closed parenthesis.
So that tells it on the current sheet, look in column I sells two through 105 and count every time there's a number higher than 50. I think for this one, I think for this one, what I was doing was counting the number of students who made a grade of 50 or higher on a certain assessment.
But anyway, then it will show you how many students scored that in the cell once you put that formula.
A related thing, this is not count if I thought this whole episode would be about count if but there's a related function called some product that achieves what I wanted to do.
So the last one shows how to count if it's just greater than or equal to something or you could do equal or just greater than or just less than or any of those operators.
What I wanted to do in this other one was find how many were greater than or equal to one number but less than another number. So in the example I have here, I wanted to be greater than or equal to 40 but less than 50.
So the formula for that would be equals some product and that is all caps, SUM, PROD, UCT, open parenthesis, dollar sign i, dollar sign 2, colon, this is actually the same range as the previous one, dollar sign i, dollar sign 2, colon, dollar sign i, dollar sign 105, greater than equal 40, comma, dollar sign i, dollar sign 2.
dollar sign i, dollar sign 105, less than 50, close parenthesis.
And then it will display however many instances there were of that. So the last kind I want to tell you about is it's related to count if but it's called count ifs.
So I guess that's mean it's like plural counted so it's considering two different things whether it counts. So I wanted to tell me what is it this one I wanted it to tell me how many I better go back and look.
Is it this one? Okay, yes. So I want it to tell me how many terminal faculty have a terminal degree and our full time faculty.
So I'm checking two conditions here before it something is counted. And so what I did for the formula, the formula goes equals count ifs.
That's all caps c o u t sorry c o u n t i f s open parenthesis and then dollar sign personnel dot dollar sign uppercase u dollar sign 1 colon dollar sign uppercase u dollar sign 135, comma reports dot a 21, comma.
Dollar sign personnel dot dollar sign k dollar sign 1 colon dollar sign k dollar sign 135, comma open quote less than greater than adjunct close quote close parenthesis.
Okay, so to explain in human terms what this is doing it's looking in column u on the personnel sheet looking from cell one through cell 135 for the reports dot a 21, oops hang on.
Yeah, okay, so it's looking for the string yes, so I'm asking does it have a terminal degree yes or no there's a column in my personnel sheet that says whether each faculty has a terminal degree or not this differs according to one's discipline.
For example a theater faculty has a terminal degree if they have an MFA a master fine arts whereas in most of the music fields the terminal degree would either be PhD like I have in musicology or doctor of musical arts like our performance faculty will have on their various instruments and so one of my columns is either yes or no is this person supplied with a terminal degree.
And so in that formula it's looking on the personnel sheet and column you to see whether it says yes or no and then it's counting how many times it says that now in order to restrict that to full time faculty I have to eliminate anybody who is adjunct these are people who we hire on contract to teach one or two classes at a time.
And so that's where you have to use count if's because you're giving it an extra condition.
So it's looking for the string yes and in the formula I just read to you the string yes is given in the cell a 21 of the reports sheet so that's why after the comma it said reports dot a 21.
Then it's followed by the comma and then it looks again in the personnel sheet in column K that's the rank column and it looks column K cell one through cell 135 and the less than followed immediately by a greater than means that anything that does not match this.
So when I say open quote less than greater than that means do not match anything that has the string immediately following and the string I put there is adjunct so it eliminates all adjuncts right there so that will tell me all of my full time faculty who have a terminal degree and there are 24 of them.
Then I did the same thing with the adjunct faculty and there are four adjunct faculty with a terminal degree and then 25 who do not have the terminal degree.
All right was there anything I'm sorry if this is boring I gotta say this is a really exciting thing to be able to do because it really helps me in my job to be able to tell the people above me in the administration this is how many faculty I've got who do this and this is how many who have their degrees and what not.
It also quickly shows me how many I have in each rank and what not I made another one to deal with students I got a report from institutional research the big spreadsheet listing all kinds of information about all of our music majors and and so with that I was able to generate use the same count if thing to make a report showing how many freshmen I have how many sophomores how many juniors how many seniors.
Then I have another little part here where I show how many seniors have enough hours to graduate technically but have not done so yet so seniors with more than 130 hours more than 140 and then I also have another one that counts how many students are in each of the various degree concentrations that we have.
So this table show uses the count if function to count how many performance majors how many jazz studies how many music media majors how many music education majors and so forth anyway it's it's really great to have learned about how to use the count if function it's one of those things that you're not really going to appreciate until you need it but hopefully you've found this somewhat interesting and even useful.
Alright next one a record will be about bladder again I suspect but until then this has been John Culp and Lafayette Louisiana signing off.
If you ever thought of recording a podcast then click on our contribute link to find out how easy it really is.
The creative comments, attribution, share a light 3.0 license.
