I am using a userform to input into an excel cell from a data validated list. Meaning. On the userform I start typing a location and it populates the userform then the data gets put into a cell. Now the question...How can I have that column on excel count and give me the number of locations without adding in the duplicate values. Can i do it inserting a function on a cell within excel or do I need a macro of sorts. Any suggestions how I can get a function to determine the number of different locations?
I searched and I am not sure if this was ever asked before. Thank you very much for your time.
Depending on the size of your data this can take a while to calculate, but this array formula will give you the number of unique entries in a range.
=SUM(1/COUNTIF(A1:A10,A1:A10))
Where A1:A10 is the actual range containing your data, of course. You must confirm the formula with ctrl+shift+enter. Or, in VBA, it's
Range.FormulaArray = "=SUM(1/COUNTIF(A1:A10,A1:A10))"
Edit: To account for empty cells try this:
=SUM(IFERROR(1/IF(NOT(ISBLANK(A1:A10)),COUNTIF(A1:A10,A1:A10)),""))
Again entered as an array formula.
Related
I am attempting to count the number of blanks in a large (1 million + cells) dataset, that has been pulled through using a =FILTER formula (from a larger dataset).
Due to the way Excel handles the =FILTER formula, every single cell is populated with =FILTER, even if it's only pulling a blank value.
Is there any way to count the blank values that are in the =FILTERed dataset? I've tried using =COUNTBLANK and =COUNTIF('RANGE:RANGE'=""), but because the cells aren't physically empty, they just have no value, it always yields zero.
The thing is, the same formula works fine in Google Sheets, as Google Sheets doesn't appear to put =FILTER into every cell of the filtered array. I've included an example here showing a dummy example of my dataset, including a side-by-side screenshot of how it behaves in Google Sheets Vs Excel: https://docs.google.com/spreadsheets/d/1-_mULvQG580EqSMci9gY3Ccll3yjwILTwI6TxglUQgs/edit#gid=0
Any help would be appreciated. Thanks!
The only way I know how to do it is by counting the number of rows and subtracting the cells that contain "PENDING".
=ROWS(J4:J7)-COUNTIF(J4:J7,"PENDING")
In your representative data in Excel, the cells aren't blank but have a value of 0 so you can just count that:
=COUNTIF(J4:J7,"0")
If you want a count of "true" blank cells (although COUNTBLANK should work for this) you can check the length of text in the cells using:
=SUMPRODUCT(--(LEN(J4:J7)=0))
Or
=ROWS(J4:J7)-SUMPRODUCT(--(LEN(J4:J7)>0))
I'm hoping someone can help me make better use of the INDIRECT formula.
I have a list of sheet names in a table and an INDIRECT formula that uses that list to return a value in a specified cell - the list of sheet names is just an easier way for me to drag the formula down the table and read the appropriate cells without having to manually link each sheet.
=INDIRECT("'"&A2&"'!"&"K10")
This works fine for single cells as the range ref is simply stated as the text in the formula (K10), the problem arises when I need to start referring to a range such as K10:K15 and summing the values.
The range K10:K15 will inevitably have new rows added or deleted on the relative tab and as INDIRECT is using text as the reference it means the range doesn't automatically adjust - this is as I understand it one of the 'benefits' of INDIRECT but in this case is actually holding me back.
Also worth noting that the range (K10:K15) may move as rows are added/deleted above this, as this range is part of a larger table.
In simplistic terms I want to achieve the same result as a standard reference to a range on another sheet, e.g. =sum(sheet1!K10:K15) (as this will adjust when rows are added/deleted) but I just want to be able to dictate which sheet is referred to via a list I have in a table on a summary sheet.
How do I either write INDIRECT so the range adjusts when new rows are added/deleted or is there a different formula I should be using that achieves this?
Any advice greatly appreciated :)
=INDIRECT("'"&A2&"'!K"& MATCH(TRUE,INDIRECT("'"&A2&"'!K:K")<>"",0)&":K"&MAX((INDIRECT("'"&A2&"'!K:K")<>"")*(ROW(INDIRECT("'"&A2&"'!K:K")))))
This indirectly references the rows from the first non empty cell up to the last non empty cell in given sheet in column K. Not sure if you need to enter with ctrl + shift + enter (not in the app version).
Note: If the range contains empty cells in between the first and last non empty cell it will be included as value 0
Or in office 365 use the following:
=FILTER(INDIRECT("'"&A2&"'!K:K"),INDIRECT("'"&A2&"'!K:K")<>"")
I'm creating a large spreadsheet for my job and need to create an Index at the top which links to specific sections of the workbook. I know how to link to cells within a spreadsheet - however, this spreadsheet will be consistently adding and removing rows, meaning the cell numbers will be changing.
Is there a way to create a hyperlink to a specific value/word within a cell? For instance, can I create a link to a cell with the header phrase "Transactions List," that will always link their even if its cell number changes?
Yes, there is way. You can use Match() function within Hyperlink() function to refer cell dynamically. Lets demonstrate how to do. Suppose you have Transactions List (see attached screenshot below) word in Column F and you want to hyperlink that cell even when you add few rows before that cell. Match function will find row number of cell containing Transactions List in specified column and link to that cell by below formula.
=HYPERLINK("#F"&MATCH("Transactions List",F:F,0),"Hello Hyperlink")
Even you can hyperlink cell in another sheet by following formula. Change sheet name in your case.
=HYPERLINK("#Sheet2!F"&MATCH("Transactions List",Sheet2!F:F,0),"Hello Hyperlink")
I have a database that has many duplicates. If I select any name in a particular cell, the data related with that name should be exported to a new worksheet in the same workbook. For example, if there is a name Amol repeated 5 times, Geet 9 times, Devidas 11 times and so on, if I write Devidas in a cell, the data related with Devidas from all 11 lines should be exported to a new worksheet. I need to do this using formula alone and not VBA. Any help that will point to a solution would be much appreciated.
You do not provide sufficient data and position of data in your sheet. Also lacking of how many column do you have. Which column do you want to return in sheet2? Whatever, assuming your data in Sheet1 and you want to put filtered in in Sheet2. So, use following formula to sheet2 to filter data related Devidas.
=IFERROR(INDEX(Sheet1!$A$1:$A$21,SMALL(IF(Sheet1!$A$1:$A$21="Devidas",ROW(Sheet1!$A$1:$A$21),""),ROWS($A$1:$A1))),"")
Press CTRL+SHIFT+ENTER to evaluate the formula as it is an array formula.
You have to adjust formula for Index() function to return particular column. Let us know by comment if you feel any difficulties to apply the formula.
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.