Better way to write wordle score averager? - google-sheets

I've got a spreadsheet tracking my partner and I's wordle scores, tracking an average.
Win Turns, Me, Them
1, 0, 0
2, 1, 2
3, 4, 9
4, 12, 8
5, 5, 9
6, 2, 6
And the formula to calculate the average looks like this:
=((C2*A2)+(C3*A3)+(C4*A4)+(C5*A5)+(C6*A6)+(C7*A7))/sum(C2:C7)
I'm using Google sheets. Is there a better way to write this??

if you want something short you can use
=INDEX(SUM(C2:C*A2:A)/SUM(C2:C))
or:
=AVERAGE.WEIGHTED(A2:A, C2:C)

Related

Vlookup not able to find reference cell

I am using Google Sheets to look up a formula, but the code comes back saying
"unable to match'.25oz'"
The link for the sheet is here:
https://docs.google.com/spreadsheets/d/1K1Hb9xV8Ky51Vdiv0SG-zKOEH0ELPNBYwMWhDFfm4l0/edit#gid=168328825
The specific part I am having an error with is 'Master Cocktail' D5 where it tries to search either my Spirits sheet or the 'Beer NA Bev' sheet. for the appropriate price based on the oz used.
The code I am using in the cell is:
=ArrayFormula(IF(C5="","",vlookup($B5,{'Beer NA Bev'!$A$63:$H$71;Spirits!$A$2:$I$325},MATCH($C5,{'Beer NA Bev'!$A$62:$K$62;Spirits!$A$3:$J$3},0),FALSE)))
first of all {'Beer NA Bev'!$A$63:$H$71; Spirits!$A$2:$I$325} needs to be: {'Beer NA Bev'!$A$63:$I$71; Spirits!$A$2:$I$325} eg. same amount of columns
then you can drop the whole MATCH and put there IFERROR under which there will be IF with two VLOOKUP (one for TRUE side and one for FALSE side) to distinguish between beer and spirits because you have .25oz in both sheets. and then you can insert simple IFS to check/search for the right .25oz price and return column number for the main VLOOKUP. check this similar issue: https://stackoverflow.com/a/54680420/5632629
something like this:
IFERROR(IF(VLOOKUP(B5, 'Beer NA Bev'!$A$63:$I$71, 1, 0)<>"", IFS(C5=".25oz", 5,
C5=".5oz", 6,
C5=".75oz", 7,
C5="1oz", 8,
C5="2oz", 9), ),
IF(VLOOKUP(B5, Spirits!$A$2:$I$325, 1, 0)<>"", IFS(C5="2oz", 4,
C5="1.5oz", 5,
C5="1oz", 6,
C5=".75oz", 7,
C5=".5oz", 8,
C5=".25oz", 9), ))
and the whole formula would be:
=ARRAYFORMULA(IF(C5="", "",
VLOOKUP($B5, {'Beer NA Bev'!$A$63:$I$71;
Spirits!$A$2:$I$325},
IFERROR(IF(VLOOKUP(B5, 'Beer NA Bev'!$A$63:$I$71, 1, 0)<>"", IFS(C5=".25oz", 5,
C5=".5oz", 6,
C5=".75oz", 7,
C5="1oz", 8,
C5="2oz", 9), ),
IF(VLOOKUP(B5, Spirits!$A$2:$I$325, 1, 0)<>"", IFS(C5="2oz", 4,
C5="1.5oz", 5,
C5="1oz", 6,
C5=".75oz", 7,
C5=".5oz", 8,
C5=".25oz", 9), )), 0)))

Influxdb: Query for distinct values

First: I am aware of the distinct() function, but that's not what I want.
My problem: Imagine a series with sensor readings that barely change like e.g:
[2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 3, 3, 5, 5, 2]
In my application this series is very long (thousands of entries) and I would like to visualize it in a Diagram (on Android, but that doesn't matter).
What I'd like to achieve:
I would like to get the values, where the series changes e.g:
[2, 3, 4, 3, 5, 2]
of course with their respective timestamps and tags.
With the distinct() function the result would look like this:
[2, 3, 4, 5, ]
Thanks!

Generate random integer from discrete selection?

I am trying to generate random numbers but only certain numbers. I know to generate a random number between 0 and 10 you'd use:
arc4random_uniform(11)
But what if I wanted to generate a random number between a selection of, say 3, 5, 8, and 10?
Vacawama is right and should be given credit.
a little more thought.
Chose what number you want and put them into an array. then use the index of the array to get the
[3, 5, 8, 10]
array index starts at zero so; [0: 3, 1: 5, 2: 8, 3: 10].
using "4" within the arc4random will let you choose between 0-3.

Highcharts: how to group data points and display the total accordingly?

I am new to Highcharts. I need to display a line chart.
Here is the categories:
["9/7/14", "9/8/14", "9/9/14", "9/10/14", "9/11/14", "9/12/14", "9/13/14", "9/14/14", "9/15/14", "9/16/14", "9/17/14", "9/18/14", "9/19/14", "9/20/14", ...]
Here is the data series:
[1, 4, 0, 2, 1, 1, 1, 5, 3, 1, 0, 0, 6, 8, ... ]
What I hope to achieve is to group every three dates and their total and display it accordingly. Something like this:
["9/7/14", "9/10/14", ...]
[5, 4, ... ]
Is this something Highcharts can do out-of-box and how if yes?
Thanks and regards.
It's not possible when using categories. When using categories, then you need to calculate this on your own.
In Highstock, that feature is called dataGrouping - however, doesn't work with categories.

How to create subscale scores for 4 subscales of the REI using SPSS?

I need to create subscale scores for 4 subscales of the REI: REI_Appear; REI_Hlth; REI_Mood; REI_Enjoy. The items comprising each subscale are as follows:
Appearance (9 items): 1, 5, 9, 13, 16, 17, 19, 21, 24
Health (8 items): 3, 6, 8, 15, 18, 20, 22, 23
Mood (4 items): 2, 7, 12, 14
Enjoyment (3 items): 4, 10, 25
For example, I have placed REI_Appear in the target variable but then im unsure of what to place in the numeric expression section for it to work?
There are several important issues.
Do you want means or sums or some other composite?
Do any items need reversing?
How do you want to handle missing data?
Assuming you want means, there are no items needing reversing, and you want a participant to have at least 3 items to get a score, then you could use:
compute REI_appear = mean.3(item1, item5, ..., item24).
EXECUTE.
where you replace item1 etc. with the relevant variable names.
I have an existing post dedicated to the topic of computing scale scores for psychological tests which discusses some of these issues further.

Resources