Excel automatically sort column of numbers - excel

I am looking to automatically sort a column of numbers in descending order without touching the sort button, or VBA.
Unfortunately I am trying to achieve this in a work environment where I have no access to VBA and excel is not one of the latest versions that contains the new SORT function in 365.
It is quite literally a column of numbers, and the numbers are automatically updated as they are totals of rows of smaller numbers elsewhere, and these change based on something else - so this specific column will always change numbers, but I need the column to automatically keep on top of sorting numbers by descending order.
I tried using rank.eq and some other bits with adding a 1 to each row to avoid duplicates, but this buggered it up if more than two duplicates was found. Is there anything I can do at all? Even if it involves going a very long way round it and building extra tables and things etc.
Grateful for any help.

It'd be easier to see your data and without being able to use a spill range, it's impossible to know how many rows. I also think you're intending to use LARGE function rather than RANK.
If you had your numbers in column A, you could drag the following formula down the appropriate number of rows to get the numbers sorted... (starting in cell B1)
=LARGE(A$1:INDEX(A:A,COUNTA(A:A),1),ROW())
If you can get your numbers in a table, you could use a similar formula but the table would ensure the appropriate rows exist (assume table name is Table1 and note the column names of RawNumbers and Sorted). Put this in Sorted Column:
=LARGE([RawNumbers],ROW()-ROW(Table1[[#Headers],[Sorted]]))
I presume using a pivot table is not a viable option... but these are how you could accomplish your objective of sorting by formula.

Related

Get duplicates from two columns

I'm having trouble filtering an excel table. M, it is a set of two rows from two tables, where it is necessary to find duplicates.
2 rows with duplicates
Some idents are repeated, they are present both in the current and previous months. In the example below, with the help with this function =IFERROR(MATCH(A2;B:B;0); "NO"), I obtained information about which data from last month is repeated in the current month and exactly in which row it is located. The code for determining whether it is repeated is as follows =COUNTIFS($A$2:$B$13;A2)>1
duplicates and if repeated
I would like to retrieve only duplicates from the list, I tried the code =IFERROR(INDEX(A:A;SMALL(IF(NOT(D$2:D$104=TRUE);ROW(B2)-ROW(INDEX(B2;1;1))+1);ROW(G:G)));" ERROR")to get the ones that are repeat and skip those ones that arent, but the result is not as desired. In line G, you can see an example of how Excel gives me data regarding the entered function. In cell H, it is shown how I would like a new row to be created with only duplicates.
Current vs. desired display
In this example, the columns are a bit small, but in reality there could be at least a thousand rows, so I would need help filtering those.
You implied these columns were present in two different tables. So I used Tables with structured references. You can convert to normal addressing if you require that instead.
If you have Windows Excel 2021 or later, you can use:
=FILTERXML("<t><s>" &TEXTJOIN("</s><s>",,UNIQUE(LastMonth[Last month marks],FALSE,TRUE),UNIQUE(CurrentMonth[Current Month],FALSE,TRUE))& "</s></t>","//s[following::*=.]")
Create a list of distinct items for each row
Create an XML by concatenating the items into an array using Textjoin
Extract only those items that are followed by an identical item
With your earlier version of Excel, again, I would still use Tables and structured references but I would also use a Helper Column
D2: =IFERROR(MATCH(lastMonth[#[last month]],currentMonth[current month],0),"NO") *and fill down*
E2: =IFERROR(INDEX(currentMonth[current month], AGGREGATE(15,6,[Duplicates in Which Row],ROWS($1:1))),"")

How to count unique column data in an excel sheet

I am using excel sheet and i have data column as shown below:
As we can see that some of the names are duplicate or appeared twice. My question is how can count unique name records or rows associated with each name for summary column.
Out put i am looking for is shown below:
Not sure which formula to use as count is counting all of that data i.e. '7' in this case. How can i use count or any other function to count unique records as shown above?
You can do what you're after with a pivot table.
Click the Insert tab then select "Recommended Pivot Tables".
A window will open up prompting you to select the data range. I recommend using a named range for your list and referencing that, but you can just highlight the list directly if you want.
Once the data range is selected, click "Ok" and new window will open with exactly what you want. A unique values list and a "Count of Column1". It is the default of the recommended pivot tables.
I outlined this because it's easy and fast, but it's important to understand you can make this pivot table yourself from scratch if you learn about pivot tables in general. Pivot tables are often overlooked in Excel as an option.
Lastly, you could get really advanced with Excel Power Queries. Just Google "Excel Power query" and you will be shown all kinds of information on them. They are a close second place in power to manipulate Excel data short of using VBA.
Good luck!
CountA(Unique(D2:D8,,False)) = 5 [Count(Unique(D2:D8)) is the same as False is the default.]
CountA(Unique(D2:D8,,True)) = 3 (once and only once)
Note: the Unique function was released in late 2019 to Office 365. So if you want to use this check your version, not present in 1908, present in 2006.
Edit: It's actually in 2002, I just updated my 1908 machine.
HTH
If names duplicates are removed the following formula can be used: =COUNTIF(B:B,F2)
If duplicates must be removed by formula, MATCH (searches for a specified item in a range of cells, and then returns the relative position of that item in the range.) and SMALL (Returns the k-th smallest value in a data set.) functions can be used as shown.
C$1048576 is used to reference last row number for a big list case.
formulas:
Column A, names sequence
Colunm B, names
Column C, formula =MATCH(B2,B:B,0)
Column D, formula =IF(COUNTIF(C2:$C$1048576,C2)=1,C2,"")
Column E, formula =SMALL(D:D,A2)
Column F, formula =VLOOKUP(E2,A:B,2,0)
Column G, formula =COUNTIF(B:B,F2)
For anyone like me without O265's lovely Unique & Filter Functions, and who doesnt want to use a pivot table, and there are many ways to do this, but this i have just done this in normal excel.
List of data in Column H, Formula in column O3. Drag down. Highlights your distinct and unique values from H.
=IF(COUNTIF(H:H,H28)=1,"U - "&COUNTIF(H:H,H28),IF(COUNTIF(H$1:H27,H28)=1,"U - "&COUNTIF(H:H,H28),"-"))
Formula is short. You can just do this and drag down. Apply the same principal to your worksheet data wherever it is.
=IF(COUNTIF(H:H,H3)=1,"U",IF(COUNTIF(H$1:H2,H3)=1,"U","-"))
Similarly, you can just use this formula here (credit goes to this source for this one):
=(COUNTIF($H$1:$H1,$H1)=1)+0
Id like to point out that the above formula is a better formula than mine. It highlights with a "1" (or with a tweak, the value of your choice) the first time any value is seen/spotted on any given list, whether duplicate or unique.
Whereas mine is a bit "more random" when picking up the "unique and distict" values.
Mine gets there in the end, but Extend Office's gets there first, as I think is proper (getting the first time a unqique distict value is spotted/occurs.).
Formula in K5 =IF((COUNTIF($H$5:$H5,$H5)=1)+0=1,"UNIQUE DIST","") and drag down...
You could append/add a normal basic countif after the results to show how many actual times the given value appears if you wanted. :
=IF((COUNTIF($H$5:$H5,$H5)=1)+0=1,"UNIQUE DIST","")&" - "&COUNTIF(H:H,H5)

Returning sum of column for filtered data, without filter

I'm trying to calculate the sum of a column (TSQFT in the screenshot) that is part of a data set, which would be filtered based on multiple criteria using cell references (see screenshot). I don't want to use excel's regular filter as it's a hassle to change the settings and I'd like it to be done in a more automated way.
I've tried {SUMIF} and {SUMIFS} but those do not work as a filter - i.e. for a row to be {TRUE}, the numbers have to be in the same order as that specified in the criteria list {5-7-2} (see screenshot).
Would much appreciate any help.
You can try something like this:
Make 3 column of =IF(OR(C3=$C$10;C3=$D$10;C3=$E$10);1;0) formulas, one more column for a sum of this 3 column and a sumif based of the sum values
if the sum is 3 then the value is good.
This maybe the worst solution for this but as long as it can help, it can be developed into something better.

Excel Filter, but Do Not Allow Sort

I have a spreadsheet that I am working on, which will create a unique letter & number combination, based on the number of occurrences of the same value in Column E. This works great, except if someone sorts the rows, then the letter & numbers in Column A, recalculate. I would like for users to be able to filter the list, but just not sort it.
Alternatively if the values in column A could somehow be static once calculated, then it wouldn't matter.
Is there a better way that I should be approaching this?
I can not really see your pictures but did you try to make it a pivot on a second sheet and insert a "calculated field" if needed? This usually works. They can even filter and sort it this way if the formula stys the same for all rows.

Identify column index in Excel

I have a NxM matrix saved in an Excel file. It is easy to identify the rows indexes since they are displayed by the program itself. The columns however are indexed by the letters of the alphabet and I am not able to recognize the index of the column once the matrix dimensions become too large. Of course I could count every single column but this is not a practical way to proceed.
So here is my question: what is a simple way to identify the index of a generic column in Excel?
My goal would be to add a specific row and column to my matrix and the only way I could to do it is by knowing what index the column has (The letters do not help me because I should count all of them until I reach the one that I am interested in).
Go to Options. Select Formulas. Make sure that under the voice Working with formulas, the box R1C1 reference style is checked.
You can use formula =COLUMN() to get the index of the current column. In case you have table with column offset then you can adjust it like =COLUMN(CurrentColumn)-COLUMN(LastColumn).

Resources