Unique value in excel - excel

I have an array of numbers in Excel spanning from Cells B1 to F49. Out of all those numbers I want to find out the unique values, in other words, no duplicates. I tried using Remove duplicates but it looks at the rows and not the individual cells. What would be my best option for doing this? any help would be greatly appreciated.

You could try this array formula that returns unique text or numbers from a rectangular range.
Select a range to output the results to eg: H1:H245
Copy and paste the formula below into the formula bar.
Press Ctrl+Shift+Enter to enter into the range.
=IFERROR(CELL("Contents",INDIRECT(T(IF(1,TEXT(MODE.MULT(IF(FREQUENCY(COUNTIF(B1:F49,"<="&B1:F49)+ISTEXT(B1:F49)*COUNT(B1:F49),COUNTIF(B1:F49,"<="&B1:F49)+ISTEXT(B1:F49)*COUNT(B1:F49))>={1,1},MODE.MULT(10^5*ROW(B1:F49)+COLUMN(B1:F49),10^5*ROW(B1:F49)+COLUMN(B1:F49)))),"r0c00000"))),0)),"")

I'd probably put this formula in column C: (or another empty column you have):
(so starting in cell C1: )
=COUNTIF(B:B,B1)=1
(and copy/paste the formula down)
It will return TRUE if it is unique. So you can then filter things out via Filter, or with other formulas down the road.

It may be easiest to just combine your information into one long column and run a remove duplicates. If this is not an option you may want to look at writing a macro to crawl through the records.
You could have a macro go through each column for the rows specified and determine if the CountIf function =COUNTIF(B2:F49,B2) returns a value >1
if it does there are at least 2 instances of this number.
I'm not sure how you want to identify your unique cells but you could potentially set a text color or return the values of the cell to another location.

Simplest for identification of values unique within the entire array may be to highlight the entire range with ‘standard’ formatting of choice for uniques, then select the entire range, Conditional Formatting, Highlight Cell Rules, Duplicate Values…, and choose a custom format of no fill and font of whatever you started with.

Related

How to define excel SUMIFS criteria considering any text and numbers?

My SUMIFS formula criteria is based on a cell (say A1) that is data validated by list and changed via selection by user. If cell has data inside text or number by selection from drop down list, SUMIFS formula is considering that data as criteria to calculate the related sum. If criteria cell is left blank, I want formula to sum everything without any condition. My problem here; in criteria field of SUMIFS formula, I typed if condition like; SUMIFS(sum-range,criteria_range,IF(A1<>"",A1,"*")) but in this case excel considers only text values and do not include cells containing number. Briefly, if nothing selected in A1, I want SUMIFS formula to sum everything without any condition, numbers, texts and even blank cells. How can we proceed to do that?
EDIT:
Here an example for data and formula, what is expected is actually to disable criteria if one of selection is blank on left. Harun's suggestion works but if there is blank cell in criteria range, then in this case it won't consider those values in sum. For instance, if we select from left Phone/smart/touch, then how can we get "2" as output no matter what is in cri_range4 cells? Thanks
Example:
How about this solution? It basically ignores a missing entry in column C and evaluates only the other two. (Your example formula has a fourth criterium that isn't apparent in your list but the method can be extended for as many criteria as you might have.
=SUMPRODUCT((IF(LEN(C2),(INDEX(Lists,,1)=C2),TRUE))*(IF(LEN(C3),(INDEX(Lists,,2)=C3),TRUE))*(IF(LEN(C4),(INDEX(Lists,,3)=C4),TRUE))*SumRange)
For better readability I created a named range Lists which comprises your sample range E2:H10 while I named I2:I10 as SumRange'. INDEX(Lists,,1}` refers to the first column of the range. It's important that SumRange and Lists have the same number of rows.
If A1 is blank then just use not equal operator to sum all cells that are not blank. Try below.
=SUMIFS(D1:D5,C1:C5,IF(A1<>"",A1,"<>"))
Edit: can you check below formula in D3 cell then drag down.
=IF(C2="",SUM($I$2:$I$10),SUMPRODUCT(($E$2:$H$10=C2)*($I$2:$I$10)))

Make a list of values in one column, which do not exist in a second column

I have a worksheet with two columns of data. Column A contains thousands of records, and Column B contains only a few records. I wish to identify which values in Column B do not exist in Column A, and display these in Column D. What is the quickest way to achieve this? Happy to use formulas, or otherwise.
I would use conditional formatting and filters:
Formula being:
=ISERROR(MATCH(A1,B:B,0))
I'd then filter on highlighted cells, select the cells in column A and use Alt+; to select only the visible cells, then paste in D.
Last, I'd clear all the conditional formatting and clean up anything left.
Using formulae would be a little more complex; usually the most of the time would be spent designing it, and it's an array formula (invoked correctly only with Ctrl+Shift+Enter):
=IFERROR(INDEX($A$1:$A$27,SMALL(IF(COUNTIF($B$2:$B$6,$A$2:$A$27)=0,ROW($A$2:$A$27),9^99),ROW(D1))),"")
The formula can also take some time to calculate for larger datasets.

Expanding an Excel formula without referencing the previous cell

I am attempting to use an IF statement to check whether the sum of two cells from another Excel sheet is greater than or equal to 1.
For a sheet called Test1 with the values of interest in column C, this is what I have so far, which works fine:
=IF((Test1!C1+Test1!C2>=1),1,0)
In column B on a second sheet that I'll call Test2, I want to copy this formula down 200,000 rows. However, if the aforementioned formula is in cell B1, for the formula in B2 I would like the formula to read:
=IF((Test1!C3+Test1!C4>=1),1,0)
I want to copy the formula down the column so that the second cell reference in the formula in the first row does not become the first cell reference in the formula in the second row (eg. it would go C1+C2, then C3+C4, C5+C6, etc.).
I have tried manually entering the formula for a few rows, highlighting those, and copying them down but can't get the desired cell reference pattern. If I highlight and drag these first three formulae down another three rows, C4 and C5 are repeated and not in the correct pair.
=IF((Test1!C1+Test1!C2>=1),1,0)
=IF((Test1!C3+Test1!C4>=1),1,0)
=IF((Test1!C5+Test1!C6>=1),1,0)
=IF((Test1!C4+Test1!C5>=1),1,0)
=IF((Test1!C6+Test1!C7>=1),1,0)
=IF((Test1!C8+Test1!C9>=1),1,0)
I have tried using OFFSET() within this formula but couldn't get it to work. I am basically just wanting to add 1 to each of the cell references in the formula, as compared to the previous row (but not to actually add 1 to the value of that cell, as would happen with C1+1 for example).
Any insight would be greatly appreciated!
If you plan on copying this down 200K rows then you will want the absolute simplest formula that accomplishes the stagger. Avoid the volatile OFFSET function or be prepared to spend a lot of time waiting for random calculation cycles to complete. A volatile function will recalculate whenever anything in the workbook changes; not just when something changes that involved the formula in the cell.
=--(SUM(INDEX(Test1!C:C, (ROW(1:1)-1)*2+1), INDEX(Test1!C:C, (ROW(1:1)-1)*2+2))>=1)
The following formula should do the trick:
=(SUM(INDIRECT("C"&ROW()*2-1);INDIRECT("C"&ROW()*2))>=1)*1
And that's the version using IF:
=IF(SUM(INDIRECT("C"&ZEILE()*2-1);INDIRECT("C"&ROW()*2))>=1;1;0)
You say I am basically just wanting to add '1' to each of the cell references in the formula but appear to be incrementing by 2, so I am confused but an option might be to apply you existing formula to 400,000 rows, together with =ISODD(ROW()) in another column, then filter on that other column to select and delete those showing FALSE.
Excel's autofill won't do the 2-cell shift that you're looking for. You can use the functionality that is there.
Put =IF((Test1!C1+Test1!C2>=1),1,0) in the top cell and drag a copy to the second row (it will be =IF((Test1!C2+Test1!C3>=1),1,0) but that's okay). Now, put 'A' and 'B' in the next column. Select all 4 cells and copy them down 400k rows.
Use filter to delete rows flagged with 'B' and delete the blank rows.
(Select blank rows with [F5] click Special and select Blanks, then right-click and delete)
Here is all you need. It's fast and nonvolatile.
=--(SUM(INDEX(Test1!C:C,ROW(1:1)*2-2):INDEX(Test1!C:C,ROW(2:2)*2-2))>=1)
Copy it down as far as you like.

Highlight cells based on 10-15 values and post alternatives

I have a 1600-2000 rows of data in a spreadsheet that changes daily. I would like to highlight any row that contains such as 000000000000053851 in the R column. I had tried conditional formatting using this formula:
=OR($R1="000000000000549543",$R1="000000000000267294,$R1="000000000000053851")
but it seems to highlight a few rows that are blank in column R also.
Using the same numbers highlighted in column R, I would like to have an alternate number and possibly other data pasted into the corresponding row in column S. Each number has a unique alternate number and data to go along with it. This is how I picture a line may look with the highlighting and alternate data next to it:
I intend to record a macro using a few of the different steps that are likely required to do this. Any way, whether conditional formatting or an array formula, would be great to help with this.
For the sample provided, a CF rule of:
=LEFT(R1,12)="000000000000"
applied to ColumnR will format the sample and if you wish the cell immediately to the right. It will not highlight blank cells.
HOME > Styles - Conditional Formatting, New Rule..., Use a formula to determine which cells to format and Format values where this formula is true:, enter formula from above and Format... with Fill red, OK, OK.
If you want the cell to the right to be formatted also, select ColumnsR:S instead of just ColumnR and change R1 in the formula to $R1.
For the cell to the right you provide few details but VLOOKUP in conjunction with a two-column table should suit. Column on the left being the ColumnR value, with the right-hand column for the same row the ColumnS value required. This table could be placed almost anywhere.
This could all be done with Record Macro.

how do i convert list in reverse order in excel sheet

I have written some values in column and I want to make it in reverse order.
Insert a column next to the column you want to sort
From the top cell in the new column, add 1 to the first cell, 2 to the 2nd cell, etc. until you reach the bottom cell.
Select both your original column and the new numbered column
Go to Data > Sort
Sort by the new column, descending.
You're done!
NOTE: If you want to know how to do this using VBA code, please specify as such in your quesiton. Otherwise, this answers your question and it really belongs on superuser.com
Suppose you want to invert the range E1:E6 and place the inverted list in range F1:F6.
Enter this array formula in F1. (This is an array formula so you must press CTRL+SHIFT+ENTER)
=OFFSET($E$1:$E$6,MAX(ROW($F$1:$F$6))-ROW(),0)
Then select the entire F1:F6 range, and use Fill Down (Home tab / Editing) to copy this formula down into all the cells in the range F1:F6.
You could add an extra column which numbers 1,2,3,.... N. Next you use this column to sort the area that includes your data in reverse order (descending).
Why use the Offset or an array formula?
Why not use "=($E1-(MAX($E$2:$E$)+1))*-1", enter this in Cell F1 and copy down.
No array formula, no Offset, cleaner, and simplier, IMHO.

Resources