Excel - How to do I reference a cell next to a cell with an x in it in another sheet? - match

In sheet 1 column 1 is a vertical list of words (e.g. A1:A25).
In sheet 1 column 2 I want to randomly put an X (e.g. in one cell between B1:B25)
In sheet 2 I want to return whatever word is to the left of the X in sheet 1.
How would I do this?

If the "X" was on the left you could use VLOOKUP to find the word to it's right, but if the "X" is on the right then you need INDEX and MATCH:
=INDEX(Sheet1!$A$1:$A$25,MATCH("X",Sheet1!$B$1:$B$25,0))
If you need to find the Nth "X" then you can't use that method because MATCH returns the row number of the first match it finds. So you need SMALL to get the Nth smallest row containing an "X":
=INDEX(Sheet1!$A$1:$A$25,SMALL(IF(Sheet1!$B$1:$B$25="X",ROW(Sheet1!$B$1:$B$25)-ROW(INDEX(Sheet1!$B$1:$B$25,1,1))+1),N))
Set that last "N" in the formula to the item you want to find - if it is 1 then it finds the first item with an "X" and if it is 2 it finds the second, etc.
So for the first "X":
=INDEX(Sheet1!$A$1:$A$25,SMALL(IF(Sheet1!$B$1:$B$25="X",ROW(Sheet1!$B$1:$B$25)-ROW(INDEX(Sheet1!$B$1:$B$25,1,1))+1),1))
And for the second:
=INDEX(Sheet1!$A$1:$A$25,SMALL(IF(Sheet1!$B$1:$B$25="X",ROW(Sheet1!$B$1:$B$25)-ROW(INDEX(Sheet1!$B$1:$B$25,1,1))+1),2))
This is an array formula so when you type it in you need to press Control-Shift-Enter instead of just pressing Enter by itself. After it has been entered it will be displayed with braces around it.
I adapted this formula from https://exceljet.net/formula/get-nth-match-with-index-match and they have an in-depth description of how it works.

Vlookup is taking from left to right. If you exchange columns in sheet 1, you can use =vlookup() formula.

Related

How to make the set of possible values for UISlider an open interval?

I am using a UISlider to allow a user to choose among four options. I ask the user a question of the form "how much do you like this thing?", they respond by moving the slider, and then behind the scenes I map the value of the slider to one of four elements of an array. I want the first quarter of the slider to correspond to the first element of the array, the second quarter of the slider to correspond to the second element of the array, and so on.
By default, the range of a slider is [0,1], so one natural way to do what I want is:
let index = Int(rangedSlider.value * Float(currentAnswers.count) )
assuming that rangedSlider is the name of the outlet connected to the UISlider in question, and currentAnswers is the array of answers I'm mapping to. The issue with this is that if the user moves the slider all the way to the right, that sets the value of the slider to 1, which maps to index 4 by the formula above (assuming there are four answers). I can always add an additional line of code that takes care of that case separately,
if rangedSlider.value == 1 { index = currentAnswers.count - 1 }
but I prefer a one line solution.
I can also set the max value of the slider to 0.99 in the Storyboard and stick with the first line of code I wrote, but I want to know: is there a built-in way to make the range of UISlider values an open interval? Is there a better way to get the behavior I want?
Is this any more complicated than:
let index = Int(rangedSlider.value * Float(currentAnswers.count - 1))
Or have I misunderstood the problem you're having?
That way your index will be returned as a number between 0 and 3 with 0 corresponding to the first answer and 3 corresponding to the fourth answer.

Use every single individual value from column in Tableau

I have a column known as "Gender" that has values 1 = Male and 2 = Female.
Each column has a corresponding value next to it, as follows:
Gender Value
1 500
2 300
1 300
2 400
and so on.
I want to plot this (with each individual value) on a tableau sheet but if I put either of these measures it just SUMs it up by default. Is there a way to plot it like a normal graph with say one attribute as row and the other as column?
Drag Gender to the dimensions section of the data pane (left margin). You might also want to right click on it and edit the aliases.
If you don't want aggregate values in your viz, you can turn that off with the Analysis menu

Adding Two Subtotals in SSRS to Another Cell

I've got a report that I want to sum some of the columns and then do some basic subtraction on the summations on a row underneath. In my screenshot, I've got the columns summing correctly, and the row is hidden which is what I'm looking for.
But I'm not sure how or if I can then take the Sum(Prod_Coll) minus Sum(Proc_Perf) and make that value display in the bottom right cell (Drop Total Here).
Is this possible to do within SSRS?
right click on the empty cell, click create placeholder, click the Fx button next to value and enter:
=sum(prod_coll)-Sum(Proc_Perf)
That should do it unless I'm missing something.

Why is cell increment not detected correctly in LibreOffice Calc

I have a column which I'd like to fill by selecting the top two cells and then drag down the column.
The cell contents are:
=Sheet1.B11
=Sheet1.B31
So when I drag down I expect to see
=Sheet1.B51
=Sheet1.B71
Instead, I get
=Sheet1.B13
=Sheet1.B33
Why is Calc not detecting the increment correctly? Adding more cells manually does not help.
The numbers in cell references are not single numbers which can be used to create a series in this way. In other words: The cell reference B11 is not "B"&11, but even one single cell reference.
To get references from Sheet1.B11 upwards in steps of 20, you could use INDEX like this:
=INDEX($Sheet1.$B$1:$B$100000,11+(ROW(A1)-1)*20)
Put this formula into a cell and fill it down.

change column letter in formula with drag down

This is the formula
=SUM(Sheet2!A2:A10)
What i've been trying to do is as I drag down the column to have the formula change to =SUM(Sheet2!B2:B10) and so on.
Basically is what happens we drag to the right we get an increment on the column letter, but I want it when I drag down
For a limited number of rows, the formula below in Row2 and copied down should work:
=SUM(INDIRECT("Sheet2!"&CHAR(64+ROW())&"2:"&CHAR(64+ROW())&10))
Beyond 26 rows I would suggest switching to using a helper column instead of creating teh character value from the row number.