May 03 2021 12:17 AM
May 03 2021 12:17 AM
I have test data of 101 rows containing 3 or 4 Alphabet symbols in 5 columns. Some of these 3 or 4 letter symbols can be found across all 5 columns though not in the same row e.g. "BDRY" can be found in all columns but in different rows when eyeballing each column. My intent is to programmatically find all such values across all 5 columns because the values in each of the cells can change. Also note, all 5 columns have been sorted A-Z individually.
I think I have got close with this formula but cannot figure out the >0,1,0 or =2,0,1 which are arrays for 3 columns which is perhaps why I am getting an error (0 value across all values ).
My intention is to compared all 5 columns. Can someone please correct this formula? Test file (Test_data.xls) attached)
May 03 2021 04:37 AMSolution
@Amlesh7400 Perhaps easiest with Power Query. In the attached workbook you'll find a sheet called "Count". I trust you can do your analysis from there.
May 04 2021 08:48 PM
May 04 2021 09:26 PM
@Amlesh7400 Well, the query that generates the table is in the file that is attached to my previous post. Depending on your Excel version you may have a separate Power Query tab/ribbon or you'll find the tools needed on the Data ribbon under "Get & Transform Data".
The steps applied to achieve the output aren't very complicated, that is, if you are familiar with Power Query. Otherwise you may get lost in all the options and icons.
May 04 2021 09:47 PM
I have got the latest version of Excel for 365 subscription but don't know much about Power Query so thanks for the tip to help explore to refine my skills.
btw I stumbled upon a simpler formula using conditional formatting > highlight cell rules > use a formula to determine which cells to format
Output is highlighted in chosen cell colour.
May 04 2021 09:59 PM
@Amlesh7400 To begin with PQ, the link below could be a good starting point.
As to your other question, I'm not sure what the problem is. The rule you mentioned, colours a cell if the value in A2 occurs more than 4 times in the range specified A2:E101. If that is not what you want, what is it?
May 04 2021 10:02 PM
May 05 2021 02:17 AM
Since you are using Excel 365, you could list the codes that appear in each column using
= LET( n, ROWS(Table1), k, SEQUENCE(5*n,,0), c, 1+MOD(k,5), r, 1+QUOTIENT(k,5), unpivoted, INDEX(Table1,r,c), distinct, SORT(UNIQUE(unpivoted)), FILTER(distinct, COUNTIFS(Table1,distinct)=5))
With Insider beta channel the unwieldly unpivoting step can be hidden within a Lambda function
= LAMBDA(tbl, LET( n, ROWS(Table1), k, SEQUENCE(5*n,,0), c, 1+MOD(k,5), r, 1+QUOTIENT(k,5), unpivotted, INDEX(Table1,r,c), SORT(UNIQUE(unpivotted))) )
= LET( distinct, UNPIVOTλ(Table1), count, COUNTIFS(Table1, distinct), FILTER(distinct, count=5))
May 06 2021 05:48 PM
Thank You. My skills in Excel are limited to using basic formulas so would like to know whether I have to input this "policy" (looks like AWS type policy to me) in power query? or is the "LET" formula to be created?
May 07 2021 01:40 AM
The formulas are straightforward worksheet formulas (OK, perhaps not so straightforward). The LET function, and now the LAMBDA function (available within the beta channel), are somewhat 'work in progress' that is building towards Excel as a full-blown software development platform!
I hope I have not created too much confusion; I realise that this is not what a typical Excel user expects to see!
Notes: the open and closed circles are conditional formats designed to highlight 'count=5'.
The small filtered table uses a Lambda function to 'hide' the calculation complexity.