non-unique function - arrays

Here's the sheet: https://docs.google.com/spreadsheets/d/1NCxpNFIdb-DAn4e259KRfPF8o_rv9O9KY4wOdCG6AM8
I managed to get the unique output. Another question, is there any way to get the non-unique output with a formula? I tried to search online but most said not possible :/
So I have a whole column of random numbers+alphabets (Upper and lower cases) like this: 7hyOUGvag1 in column A and I tried to apply unique(A: A) for the whole 4000+ rows in column A but it didn't give me the unique output of it, but instead it gave me duplicates of the same output still. Why? I searched everywhere but everyone seems to have no problem with the simple unique function but for me, it didn't work properly...
Is it because my rows of values are randomized with upper and lower cases alphabets + random numbers too?

try:
=INDEX(UNIQUE(LOWER(A2:A)))
the LOWER can be replaced to UPPER or PROPER
if you don't want to convert it to either of those modes mentioned above try:
=INDEX(UNIQUE(IFNA(VLOOKUP(A2:A, A2:A, 1, 0))))

To get non-unique values (duplicate) you can also use:
=FILTER(UNIQUE(A2:A), ARRAYFORMULA( COUNTIF(A2:A,UNIQUE(A2:A))>1 ))
Functions used:
FILTER
ArrayFormula
UNIQUE
COUNTIF

Related

How do I reverse an array in Google Sheets?

Suppose I have a long, unordered, and gradually growing column that I search the even numbers from.
=filter(A1:A,ISEVEN(A1:A)=TRUE)
Now I would like to reverse this result, so that the last even number in column A is listed first in the result. Many examples use helper columns or the row function, but that doesn't seem to be an option because you don't know how many even elements there are in this array before you begin. And even if I separately calculate that using rows I can't seem to figure it out. It seems like there should be a rather simple way to just "reverse" an array right?
use:
=INDEX(SORT(FILTER({A1:A, ROW(A1:A)}, ISEVEN(A1:A), A1:A<>""), 2, 0),, 1)
Try this:
=QUERY(FILTER({A:A,ROW(A:A)},ISNUMBER(A:A),ISEVEN(A:A)),"Select Col1 Order By Col2 Desc")

Define range for sum/sumif with a formula

I've been going up and down the internet to solve this. I think I am not searching with the correct parameters but I still hope you can help me.
Sample table:
I have some consolidation forms I need to fill with sums. So, in C19 (which is actually on a new tab) I would like to sum all the values C5-C12 which are mapped to the AB100 account for the consolidation, in production for example. The AB100 account is not unique to production, so I first need to define the column in which the specific row(s) have to be used to sum the values. Automating that in a formula is my key issue here.
I could easily solve this by just selecting column E as range for SUMIF but I want the formula in C19 to be able to recognize which column is to be looked at automatically, e.g. by using a "Lookup Key". I have many of those consolidation forms and I don't want to manually change the formulas on each tab.
It seems to me that all tips I found for nested SUM(IF( or SUM(INDEX( - even as array formulas - have the result value on the intersection of matched row and column. What I have on that intersection is a range of identical account numbers which need to be matched back to their respective $ values in C5-C12.
Any idea how I can do this with a formula?
Use INDEX/MATCH
=SUMIF(INDEX(D5:F12,0,MATCH(C16,D4:F4,0)),B19,C5:C12)
Using an index formula to select the column required in the SUMIFS
Hope this helps!

SUM with IF conditions for cells containing both strings and numbers

I've got a bigger table with one column that I want to focus on, containing designation and a number. I want to simply sum the numbers that meet the criteria based on a designation.
For the simplification, I made an exercising sheet (on the pic) where I split second column into two - one string and one numeric. Since my file is quite large with many columns that would need this it would be inconvenient.
In the left column it's easy to solve the problem, it could be even easier with simple SUMIF function, but an array SUM(IF... function is, at least I think, only viable option here.
So I solved the first table with array function, but what confuses me is how to modulate the TRUE statement. Simple replacement of C:C
with
VALUE(MID(F:F;4;4))
which would format my cells to get the numbers from string does not work that way - returns zero in E12 field. F12 is just application of string to number for last cell, F10.
THIS formula does not work, even adapting to different versions of the tool.
I could use VB but if possible anyhow I would like to avoid it since parts will be shared on mobile phones.
Any ideas? Thanks a lot!
Left table was split, right original format
The array formula which you used can be replaced by the SumIf formula like below...
=SUMIF(B:B,"B",C:C)
Also without the helper column, you can use the Sumproduct formula to achieve the desired output.
But don't refer the whole column in the formula like in the above SumIf formula.
Try this..
=SUMPRODUCT((B1:B10="B")*MID(F1:F10,FIND(",",F1:F10)+1,255)*1)
Change the ranges as per your requirement but remember to make them equal in size.

How to arrange table data differently by using if, match, and index?

As shown in the attached image, I need to convert A2:D10 to the format of A12:E17. The 4 tables from F1 to AB12 are my experiments using if, match, and index. Same formula gets different results and it seems to be dependent on the row position of the tables. In My previous question, I was trying to pinpoint the problem to the if function.
What am I doing wrong here?
Thanks,
Lu
enter image description here
Again, as I said in your last question: The formula has not been array entered. Array formulas need to be confirmed with Ctrl-Shift-Enter.
Without that, the first array in the IF statement does not get resolved and the Match does not return the correct result.
Make use of the Evaluate Formula tool and step through the formula.
The merged cells don't help with the cell referencing. Unmerge the cells and fill in all the labels in row 1, then use this slightly amended formula and confirm it with Ctrl-Shift-Enter. Then copy across and down.
I hope that I get the English names of the functions right:
In D14 and following cells:
=INDEX($C$1:$C$5;MATCH(1;MMULT(($B$3:$B$10=$A14)*($A$3:$A$10=B$13);1);0))
The MATCH function tells which value (by number counted from the top) matches both conditions. The INDEX function returns this value from C1:C5.

Index/Match with three criteria

I have searched and searched and searched and searched, I can only find solutions for index/match with two criteria.
does anyone have a solution for index/match with three criteria?
as a sample of my actual data, i would like to index/match the year, type and name to find the data in the month column
You can match an unlimited number of criteria by using SUMPRODUCT() to find the proper row:
=INDEX(D2:D9,SUMPRODUCT((A2:A9=2015)*(B2:B9="Revenue")*(C2:C9="Name 1")*ROW(2:9))-1)
EDIT#1:
Scott's comment is correct! The advantagesof the SUMPRODUCT() approach is that it is not an array formula and can be expanded to handle many criteria. The disadvantage is that it will only work if there is 1 matching row. The use of SUMPRODUCT() is explained very well here:
xlDynamic Paper
Because your question has numerical data, you can simply use SUMIFS.
SUMIFS provides the sum from a particular range [column D in this case], where any number of other ranges of the same size [the other columns, in this case] each match a particular criteria. For text results, one of the other recommended solutions will be needed.
In addition to being a little cleaner, this has the attribute [could be good or bad depending on your needs] that it will pick up multiple rows of data if multiples exist, and sum them all. If you expect unique rows, that's bad, because it won't warn you there are multiples.
The formula in your case would be as follows [obviously, you should adjust the formulas to reference your ID cells, and pick up the appropriate columns]:
=SUMIFS(D:D,A:A,2015,B:B,"Revenue",C:C,"Name1"))
What this does is:
Sum column D, for each row where: (1) column A is the number 2015; (2) column B is the text "Revenue"; AND (3) column C is the word "Name1".
If assuming your data starts in A1 ("Year") and goes to D15 ("????"), you can use this. You bascically just add your criteria with &, then when doing the Match() regions, connect their respective ranges with & as well.
=Index(D2:D9,Match(A15&B15&C15,A2:A9&B2:B9&C2:C9,0))
and enter with CTRL+SHIFT+ENTER and make the references absolute (i.e. $D$2:$D$9), I just didn't to keep the formula a little easier to read.

Resources