Friday, October 5, 2018

Counting instances that aren't in a set of values

Using Google sheets

People are give an option to reply other in a form. I want to be able to count The number of these. So I am using Countifs


Countifs allow us to count something if it meets multiple criteria

The first field is where to look ie where is the range.
In this case it on the tab responses in the range B2:B
note you need the exclamation mark to reference the tab
responses!B2:B

Determining if a value is not equal
"<>" in quotation marks is the same as not equals

Checking against a cell use an ampersand
&A2 will check against the value in A2

Here is the whole thing below each condition is separated by a comma.


=COUNTIFS(responses!B2:B,"<>"&A2, responses!B2:B, "> ", responses!B2:B,"<>"&A3,responses!B2:B,"<>"&A5,responses!B2:B,"<>"&A6,responses!B2:B,"<>"&A7,responses!B2:B,"<>"&A8,responses!B2:B,"<>"&A9,responses!B2:B,"<>"&A10,responses!B2:B,"<>"&A11,responses!B2:B,"<>"&A12,responses!B2:B,"<>"&A14,responses!B2:B,"<>"&A4)))

Tuesday, February 6, 2018

Checking for a generic welcome post in a twitterfeed - python

Well I have been thinking this was necessary for a while because when a year starts or a new class begins their individual blogs these start clogging the twitterfeeds with generic welcome posts. The feeds start looking like this.




Now I am no Python Guru so here is what I found out in creating the solution

I made a variable to hold what would be the last characters of the url 
welcome = 'welcome.html'   note you can replace this with what ever you have at the end of the blog title eg tenei-taonga.html

I put the last 12 characters [-12:] into a variable(welcomecheck) to check against 
welcomecheck = d.entries[0].link[-12:]

We were already checking if the post had already been promoted the highlighted text below adds a check to see if the post is a welcome one. It took me a while to work out the if statement needs to finish with a colon: the == sign is used to check that the strings match.

if post in url_string or welcomecheck == welcome:
        print('No new entries or welcomepost')

The rest of the code remains the same.


Check out a sample of the learners blogging at these twitter feeds.