Sorting text and numbers in Excel - excel

I got list of created ranges. What I want to do is sort them ascending by cell numbers they are refering to. I tried using sort option but all I came up with is to create my own sorting list...
List of ranges:
Column 1 Column 2
pp2dni2007 =szkolenia!$B$2:$E$33
pp2dni2010 =szkolenia!$B$273:$E$500
pp3dni2008 =szkolenia!$B$34:$E$83
pp3dni2009 =szkolenia!$B$84:$E$272
Desired output:
Column 1 Column 2
pp2dni2007 =szkolenia!$B$2:$E$33
pp3dni2008 =szkolenia!$B$34:$E$83
pp3dni2009 =szkolenia!$B$84:$E$272
pp2dni2010 =szkolenia!$B$273:$E$500

Here is a way (although a bit ugly).
Suppose a set up like this:
Step 1:
Place the cursor to C1 and go to Formulas --> Define Name. Define the following name:
We need to use this function to get the formula of each cell in column B because we will sort based on this formula.
Step 2:
At cell C1 enter and fill down:
=LEFT(SUBSTITUTE(GET_FORMULA,"=szkolenia!R",""),FIND("C",SUBSTITUTE(GET_FORMULA,"=szkolenia!R",""))-1)
broken down for convenience:
=LEFT(SUBSTITUTE(GET_FORMULA,"=szkolenia!R",""),
FIND("C",SUBSTITUTE(GET_FORMULA,"=szkolenia!R",""))-1)
This basically returns the row number of the reference that is stored in GET_FORMULA.
Step 3:
Select columns A, B and C and sort based on column C:
Result:
Or with formulas:
Notes:
The file has to be saved as macro-enabled in order to make the GET_FORMULA name work.
I do not really like helper columns (like column C above) but in this case things would overcomplicate without it.
I hope this helps, although it is a really ugly solution..

When I read loannis solution I came up with another solution to my problem ;)
Forgot to tell: column 2 data isn't importaat when comes to data but it is a hint on how to sort.
Okay, so it looks like that:
Column 1 Column 2
pp2dni2007 =szkolenia!$B$2:$E$33
pp2dni2010 =szkolenia!$B$273:$E$500
pp3dni2008 =szkolenia!$B$34:$E$83
pp3dni2009 =szkolenia!$B$84:$E$272
We got this data, so what is pain in here is this hard data "=szkoleni...".
To sort it out easy all is needed is to get rid of it. Using find&replace I am deleting "=szkolenia!$B$" part and then using it once again I am deleting rest of it ":*".
Now columns look like that:
Column 1 Column 2
pp2dni2007 2
pp2dni2010 273
pp3dni2008 34
pp3dni2009 84
Now it's just a case of simple sorting and voila! It can be easily used via macro too ;)
Thanks loannis, you were my inspiration ;)

Sort&Filter
Reference Link
http://office.microsoft.com/en-us/excel-help/sort-data-in-a-range-or-table-HP010073947.aspx

Related

Looking at independent, unrelated, values in two columns, find where information matches in both cells and remove duplicates into two new columns

Thanks for any help here. I've been racking my brain (and searching online I promise) for a while on this one.
I'm looking at columns A and B that have unrelated information, but sometimes the information in columns A and B are duplicates. For example cell A2 says "Frank" and B2 say "1". then cell A3 says "Frank" and B3 says "1". The information is a duplicate across two columns. The rest of the names in this example can be anything, Frank, Sally, Robert, etc.. and the rest of the numbers in column B can be anything (Image of example attached). If the information is a duplicate I'd like to output a reduced list using two new columns.
These functions need to be operable in real time. As data is added the equations must update in real time. I also can't concatenate because I need info to stay in two columns. I've see a lot of examples of doing this for 1 column of data using an array (see example 2), but I don't know how to build one that considers two columns. 1 column example: =IFERROR(INDEX($T$2:$T$9, MATCH(0,COUNTIF($X$1:X3, $T$2:$T$9), 0)),"") Any ideas how to build this out so it works for two columns?
I'd like to avoid using VBA if possible, but if it's the only way so be it. I want to avoid using VBA because a lot of people touch the spreadsheet and it's a lot easier for me to fix a function than code. Gotta love humans!
Thanks so much for your help!
Robby
example example2
The simplest way that I can think of is:
a) Select your data, and paste elsewhere either on same sheet or a new one.
b) Select one of the cells in the copied data
c) Go to the Data menu tab, and click Remove Duplicates
d) Click OK
Create a new column C that concatenates columns A and B. Then remove duplicates on the basis of column C.
https://support.office.com/en-us/article/CONCATENATE-function-8F8AE884-2CA8-4F7A-B093-75D702BEA31D

Using the 'Match' function in Excel to return a cell address

I have a list of numbers in a table that I would like to search for and bring back the cell reference of where that number resides. For example the data looks like:
A B C D
1 1 2 3 4
ok it doesn't come out very well as the first one is the row number and then each number below sits under each letter, so C1 would contain '3'....
If I wanted to return the reference number of C1 in a cell I am using the formula of =CELL("address",MATCH(AU14,C1:AG1)) but this just errors. I have tried to put an Index in there too, but I believe that index only works vertically so this bring back a #N/A result.
Can anyone assist as I've wasted too much time on this already! :)
You are indeed missing an INDEX. And INDEX works vertically, horizontally, or both depending on how it's called.
Here is a formula that works for the ranges in the pictures. Should be easy to modify.
Formula in C5
=CELL("address",INDEX(B2:F2,MATCH(C4,B2:F2,0)))
formula
results
To make CELL work you need a cell reference, e.g.
CELL("address",C1)
The trouble is that MATCH just gives you a number, not a cell reference.
Probably the easiest way is to use the ADDRESS function, so a first try might be
=ADDRESS(1,MATCH(AU14,C1:AG1,0)+2)
That would give you the right answer if AU14 contained 3, but isn't considered to be very good because it wouldn't update if you deleted/inserted rows or columns.
A better one would be
=ADDRESS(ROW(C1),MATCH(AU14,C1:AG1,0)+COLUMN(C1)-1)
Then you might want to put in some error handling for the case where it's not found
=IFERROR(ADDRESS(ROW(C1),MATCH(AU14,C1:AG1,0)+COLUMN(C1)-1),"Not found")

Excel - Unique value based on additional column

I am trying to use Excel without a macro to achieve a task trivial with a macro.
I want to check over a column and only select unique values from that column, I am using the following function I found online to do this:
=IFERROR(INDEX(list,MATCH(0,COUNTIF(A$2:$A2,list),0)),"")
This function works as expected, however I wish to extend this function and I'm not sure how.
Once I find the next unique value using above, I also want to make an additional check from a row in the same column.
As an example, if the next unique value is found in row 3 I want to check if the value in column B row 3 is "Yes".
Can anyone point me in the right direction for this?
Subject to the fact that I don't understand the formula you are happy with (so may not have understood the question) if you have labels in Row1 then in Row2 and copied down:
=IF(AND(COUNTIF(A:A,A2)=1,B2="Yes"),"Found","")
might suit your purposes.

Compare 2 lists in Excel ?

I have 2 columns in a spreadsheet. One column has around 26 extra rows than the other. I've been trying various formulas to highlight or somehow indicate which columns are missing from the smaller of the lists...
I tried filling a 3rd colum with this :
=FIND(B1,A1:A1102)
which I though returned 1 if b1 was in the list a1:a1102 alas it doesn't seem to be true.
Anybody got any solutions for comparing 2 lists and isolating differences?
Thanks
To use MATCH, go with something like the following:
=IFERROR(MATCH(B1,$A$1:$A$1102,0),0)
entered into cell C1 and copied down to the end of the data in column B
This assumes that column B contains the longer list and A the shorter, of course.
The MATCH formula will return the row in which B1 is matched in A.
You can use a combination of if, iferror and vlookup functions.
=IF(IFERROR(VLOOKUP(B1,$A$1:$A$10,1,FALSE),"missing")="missing", 1, 0)
This will find matches in column A for the values in column B. If the value is missing, the iferror will report it missing (#N/A). Then the if function will output a 1 for the missing values and a 0 for those found.
EDITED:
My bad, I suggested the wrong function - except the absolute reference, you need to use MATCH - as suggested in other answers: =MATCH(B1,$A$1:$A$1102,0) or look up the whole column: =MATCH(B1,A:A,0).
Missing items will be returned as #N/A, but it easily handled with IFERROR.
I know this is a bit old, but I could not get MATCH() to work across different tabs in the same workbook. Also, I'd rather not add columns if I don't have to. What worked for me, was to use conditional formatting:
Select one column that you want to test (assume it's 'Z' for this example)
Select Conditional Formatting -> New Rule
Select 'Use a formula ...'
Use =COUNTIF('otherTab'!$A:$A, $Z1) - where 'otherTab' is the name of the other tab, 'A' is the column in that tab you want to test against and 'Z' is the column in THIS tab
Set the color scheme that something that says "I found a match!" to you
Click OK
Then you can do the same on the other column if you need to check both.
I think you need to use MATCH instead of FIND
Or if you want to be fancier about it, check out this thread:
https://superuser.com/questions/289650/how-to-compare-two-columns-and-find-differences-in-excel

Question regarding optimal excel function implementation

I have a question about Excel! I hope that isn't too unconventional for this site...
So I have an Excel table with several thousand rows. It is kind of setup like a db in that the first three of my four columns have numerical values identifying the sequence or order that the content or fourth row contains.
I am running into some possible duplication issues, and I am remembering back to my college days something about there being a function for the type of test I need to do. I need to verify that there are no two rows that have the same values for column 1-3. There should never be a time where all three columns' values match exactly that of another row.
Is VLookUp the function I need? Any excel experts out there that know of a function I could look into? Thanks so much!
the quick one-off solution I employ for this kind of quest is the following
create a single key in one temporary column - say F "=A2 & B2 & C2 ..." if combined key - I copy this formula all the way down
create a group counter for that single key - say G "=IF(F2=F1,G1+1,1)" - I can safely include the header row here because it will move the formula into the false part
This formula in G numerates all identical keys from 1 to N and starts by 1 for a new key - I copy this formula all the way down
Important: convert G formulae into values (copy / paste special onto itself)
sort descending by G and delete/manipulate all rows where counter <> 1 - or use autofilter
later on I delete F & G columns
this may sound a bit complicated, but especially in large tables VLOOKUP, COUNTIF's etc can be very time consuming.
Hope that helps
You could create another column that concatenates the first 3, then do a countif on that. Let's say the concatenation column is D and your data begins in the second row:
=countif(D:D,D2)
Copy the formula down, then filter on >1.
I think what you need is a countifs function.
assume you add one formula in a ceel in row 4:
=COUNTIFS(A:A,A4,B:B,B4,C:C,C4)
and copy to formula to the whole column
Then the cells with value 1 is a unique set while those larger than 1 have duplicates.
If you only need to check the data once, try the "Remove duplicates" functionality. This can be found in the Data tab -> Data Tools -> Remove Duplicates. Just unselect all but the first three columns in the dialog and Excel will do the rest.

Resources