OpenOffice Calc: Counting unique strings in cell range - openoffice-calc

I'm trying to find a way to calculate the number of unique strings in a single column, excluding blank cells. So far I've seen solutions such as the following:
=SUM(1/COUNTIF(X2:X99;X2:X99))
Plus another similar formula using FREQUENCY instead of COUNTIF. However, applying this to my spreadsheet gives me a decimal value that has no apparent meaning. For example, if my column contains 20 cells containing "ABC", and 30 cells with "XYZ", I should have an output value of 2. However, this is not the case, and even I can clearly see that the above formula won't output anything larger than a 1, which has left me rather confused as to its usage.
Pivot tables seem to show the most promise, but I can't get that to work either. Here's what I tried:
Select the column, including the header
Select a new pivot table and use the selected range
Drag the header from Available Fields to Row Fields
Select the ignore empty rows option
Create the table
This then creates a table with one row per unique entry in the first column, and an empty second column. One row below is a Total Result cell, with the adjacent cell empty.
From this, I can see that there must be some sort of capability of the software to find unique strings, so it would stand to reason that there must also be a way of counting them and displaying that value in a cell. The question is, how do I do that?

Your first attempt should work if (a) wrapped in SUMPRODUCT and (b) the range does not contain blank cells:
=SUMPRODUCT(1/COUNTIF(X2:X51;X2:X51))

Related

How to return values from a specific pattern of rows, with a drag down function?

Hi there,
I want to be able to fill in data in the right hand table based off values entered in the log on the left.
So for example, column GL contains data from FR13, FR40, FR60, FR94 (every 27 rows), and rather than always type in '=FR' followed by the row number I'd like to drag down a formula to return the values.
I would also like to be able to drag the formula down the column
I have tried using ROWS and INDEX but it hasn't quite worked.
Many thanks for your help
Tried using ROWS and INDEX, expecting it to select the cells I wanted, but the pattern failed.

If statement based on presence of duplicates

If the data in column A is found in multiple rows, look at the data in column C for those duplicate rows. Whichever is highest value in C, return the value from the respective row but column B. In my picture, I'm trying to populate the stuff in yellow automatically, ideally with formulas in excel. Any help is greatly appreciated.
enter image description here
My first attempt was this (a formula that you may copy on cell D2):
=INDEX($A$2:$C$9,MATCH(MAX(IF($A$2:$A$9=A2,$C$2:$C$9)),$C$2:$C$9,0),2)
This is what it does: the combo INDEX-MATCH does what VLOOKUP does, but it is more efficient than VLOOKUP. Basically it commands Excel to navigate the $A$2:$C$9 range and then find the following match:
Find the row with the MAX price for the same Item (this part: MAX(IF($A$2:$A$9=A2,$C$2:$C$9)));
Then return whatever value is on column B, at that row.
Albeit this formula seemed to work, I tried something out: what if, by some unfortunate coincidence, the MAX price for two items was the same?
This is what happens when CDE888 sells for 217
Thus, one can tell the formula above is wrong and needs a fix. This is the new formula:
INDEX($A$2:$C$9,MATCH(A2&MAX(IF($A$2:$A$9=A2,$C$2:$C$9)),$A$2:$A$9&$C$2:$C$9,0),2)
This time, the formula looks for a value that is composed of the Item code AND its highest price.
The rest works exactly as the first formula.
One last word: I wrote this formula on cell D2, then dragged the formula down.

How can I cleanly order data in the desired sequence within Power BI Visualizations? (Line and Stacked Column Chart)

I am working on a report that displays monthly data most of which are represented in the following format, XX+YY (IE 01+11,02+10,03+09, etc.). The first set of digits reflect the represented month, so these naturally order themselves in sequence.
Image of visual with correct sequence
However, I must also include the financial plan for the year is in the format "FYXX Plan" where XX is the last two digits of the calendar year. When sorting text Power BI orders leading numbers before leading letters, so this moves the plan column to the END of the data set instead of where it logically belongs at the FRONT.
Image of visual with incorrect sequence
Is it possible to re-order my visual to still show the XX+YY monthly data in ascending order, but to move the FYXX Plan data to be the first column shown?
Very respectfully,
Jon J.
You could add a new column for sorting, stripping out the 'FY' when it exists e.g.
SortColumn = IFERROR(mid(Sorting[Date],find("FY",Sorting[Date])+2,10),Sorting[Date])
(For any value which includes 'FY' the mid function will show the remaining characters, if FY is not found it will error, and give the full date, there are a number of ways to achieve this using e.g. IF statements etc.
You can either replace the axis with this column, if you really need it to display as 'FYxx' you could set First(SortColumn) as the tooltip text to allow you to sort by that instead.

How to alternate values of a =textjoin range in spreadsheets

first of all excuse my poor English, I'm trying to get the exact words to summarize my problem.
I'm trying to make a formula to concatenate a big range of cells by alternating its crossed values.
If you see the image, I have some titles (3rd row), and some variable values for each column from B to D, in the rows 5 to 7. The number of columns and rows will expand in actual project. Then, I need to summarize all crossed data to make some processes later: I need the output written at column F, where I get the title and then the cell value.
If I use =TEXTJOIN(",";;"$B$3:$D$3;B5:D5) I get the output at H5, but It makes me to get many problems later at processing information.
I have tried to make some extra columns or cells concatenating content of each "title" and "value", and then, joining everything, but it's a poor solution if I'm trying to build a sheet with hundreds of columns. I'm sure there would be another better solution, but I can't figure out by now.
your formula should be:
=ARRAYFORMULA(SUBSTITUTE(REGEXREPLACE(TRANSPOSE(QUERY(TRANSPOSE(
IF(B5:D<>"", ","&B3:D3&","&B5:D, )),,999^99)), "^,", ), " ,", ","))

Same row different column. Excel Formula

If is possible with the if(indirect formula to give me the value from the same row but from a different column if a specific cell is from that row?
More specific: I want cell =Sheet2!F23 to give me =Sheet1!N11 if =sheet2!C23 is from Sheet1!B11.
The important thing is the I need it to come from row 11 but from a different column.
Thanks in advance.
I did the following:
On Sheet 1 i gave all the rows a unique number in column A
On sheet 2 i just put in the unique number(C23) and the rest of the cells on that row used the formula below with. The only thing i needed to change was the index of which column needed to be matched.
It might not be the most efficient way but i worked for me.
=IFERROR(INDEX(Sheet1!B:B;MATCH($C23;Sheet1!$A:$A;0));"")