Determine if an Excel column has any value? - excel

Question: with or without VBA, how can we determine if a specific column (say column "A") has any value in any cell in it?
Remarks: Question is about finding out whether a column (with a header, say, LastName) has any value (text/number) in it. The search is not on any specific value.
Reason for the Question:
We have more than a 1GB Excel file with about 1 million rows and several columns with headings. When we scroll down to one of the columns the column looks empty. But since the file has more than 1 million rows, we just keep scrolling down with no text found. But it is taking too much time to keep scrolling down to determine if there is any value inside the column. And, we may have to do the same for some other columns that do seem empty. So, we are looking for a better way to do it.
The issue is somewhat related to what's described in item 4 of this article: Tackling the most common errors when
trying to import a CSV

Consider Conditional Formatting
Apply to Header Row only
Select header row cells containing headers (not the whole row)
Add CF Formula, and set format to suit your preference
=COUNTA(A:A)>1
Highlights headers in columns that contain data. To highlight columns headers that don't contain data, use
=COUNTA(A:A)<=1
Note: this will consider cells that contain an empty string (eg from a formula) to contain data. If you want to consider those cells as empty, use
=COUNTBLANK(A:A)=ROWS(A:A)-1

Related

Find common rows from a given range of rows in excel

So I have to clean data where from a given range of rows maybe 2 or 3 are exact same, rest have at least one column different. I need a way to find it out as I don't want to do it manually. I've tried conditional formatting but that only works with columns.
In the image you can see rows 550:569 a few of them are exactly same. How do I highlight or find out that. I don't want to manually check each column
enter image description here
Insert a column (let's say column AG) where you put a formula like =TEXTJOIN(",",TRUE,A2:AF2)
Sort the range per the new column
Eliminate duplicate using Excel's Remove Duplicate tool.

Excel copy cell value when row does not contain certain text

I'm looking to avoid VBA if possible and manipulate some Excel data.
I have data with one column of values, containing blanks and numbers. For example column A: 1, 5, , 2. And another column containing text, for example column B: Include, exclude, include, exclude. Not sure how to put a table here, but basically:
1 include
5 exclude
include
2 exclude
I am looking to (in any order) copy data to a new column that both does not contain the word "exclude" in its row and does not contain blank data in its cell.
To get rid of blanks I use
=IFERROR(INDEX(AL$2:AL$3309,SMALL(IF(AL$2:AL$3309<>"",ROW(AL$2:AL$3309)-ROW(AL$2)+1),ROWS(AW$2:AW2))),"")
where AW is where I want copied values and AL is where the values and blanks are. Data in rows 2 through 3309.
How can I also copy only data that does not include the text "exclude" in its row? (There is a separate column for each value with a text value) If this can be done in one function, great! If not, that is fine.
Thank you!
As a small separate issue, is there a way to auto detect the last value in a column? So that for my formula, instead of updating every instance of 3309 to 3310 if I were to add another row of data, I could just say "last row containing data" if that makes sense.

Extract all rows from excel data set when multiple cells contains certain text

This question was asked and the answer ALMOST works for me.
THE PROBLEM
Very simply from the above dataset I wish to recreate this range but filter for only select BLOOD TYPE O.
The answer given is:
=IFERROR(INDEX(A:A,SMALL(IF(ISNUMBER(SEARCH("O",INDIRECT("$A2:$A"&COUNTA(A:A)))),ROW(INDIRECT("$A2:$A"&COUNTA(A:A))),""),ROW()-1)),"")
This works only in ROW 2. I have tried everything to get this to begin in a new row and column (I also want the data to be in a different row and column) but whenever i update the formula, nothing is returned.
ED please see this new picture:
In the image above, I place your example data set in the range C3:F13. Based on your question it sounded like you were trying to filter your list based on blood type, but I was not sure if you just wanted names, or some other combination of columns. This solution assumes you want all columns in the order they are presented. I placed the following formula in I5:
=IFERROR(INDEX($D$4:$F$13,AGGREGATE(15,6,(ROW($C$4:$C$13)-3)/($C$4:$C$13=$I$2),ROW(A1)),COLUMN(A1)),"")
In I2 is the value of the blood type you are filtering your list for.
in the formula above, adjust the ranges to suit your data range locations. The -3 in the formula is for the number of header rows before the data starts. If you have headers or other space and your first piece of data was in row 15 then you would need to change -3 to -14.

Dynamic ranges again - once more, with text strings

I have a series of data sets (later to be used for populating comboboxes), and I've tried setting up dynamic ranges to list only the cells with useful data. In total, there are 160 rows of data, but the number of rows that will be populated will vary wildly.
In case it has a bearing on it (if the dynamic ranges detect "" as not blank, for example), the formula used to populate the cells in the range is
{=IF(ROW()-ROW(StartPort_NoBlanks)+1>ROWS(StartPort_Blanks)-COUNTBLANK(StartPort_Blanks),"",INDIRECT(ADDRESS(SMALL((IF(StartPort_Blanks<>"",ROW(StartPort_Blanks),ROW()+ROWS(StartPort_Blanks))),ROW()-ROW(StartPort_NoBlanks)+1),COLUMN(StartPort_Blanks),4)))}
(Based on #DennisWilliamson's answer at https://superuser.com/questions/189737/dynamically-updating-list-of-unique-column-entries-in-excel )
So far, I've tried both
='Saves_FilterLookups'!$C$3:INDEX('Saves_FilterLookups'!$C$3:$C$162, COUNTA('Saves_FilterLookups'!$C$3:$C$162))
and
=OFFSET('Saves_FilterLookups'!$C$3,0,0,COUNTA('Saves_FilterLookups'!$C:$C),1)
...but both give me the whole list, including the "blank" cells.
Most of the ranges contain text strings; one of the other ranges contains dates.
What am I missing? How do I fix it?
EDIT: To give a bit of context, here's a bit of the list. The full list contains entries scattered along its length, duplicates are removed into the second column, and they're all consolidated into a single block in the third column. They're then populated into the combobox in the userform, but all the blanks are coming in too...
Here is a potential solution for you...the caveat is the cell above the list needs to be blank
=IFERROR(INDEX($A$2:$A$13,MATCH(0,INDEX(COUNTIF($B$1:B1,$A$2:$A$13),0,0),0)),"")
That will generate the list all in one step sorted and blanks removed.
I believe your COUNTA is your culprit. COUNTA will count all cells with something in them...and unfortunately "" is something. So you will need to eliminate the count of "". so I added a -COUNTIF and assumed the same range your were counting before. The worksheet name is not required if it is all being done on the same worksheet.
=OFFSET('Saves_FilterLookups'!$C$3,0,0,COUNTA('Saves_FilterLookups'!$C$3:$C$162)-COUNTIF('Saves_FilterLookups'!$C$3:$C$162,""),1)

How to sanitize a collated column with text and numeric data to make it uniform for easy analysis in excel 2007

I have 3 column heads and I wanted to collate it with 3 similar heads from another sheets. 10% at an average from each of the 6 columns is blank, I have to map the data based on these 3 columns to other data and I need them to be sanitized. So there are the blanks and then there are some cells which have text like 208110185726A570-14. Please help.
Haven't heard back from the comment above, but I'll have a go at this anyway (and will be using assumptions that may be incorrect):
Given that you have included the tag vlookup, I'm assuming that you want to build a table that uses the leftmost column as an index of unique values to conduct a VLOOKUP. If that's the case, I don't see any way around blank cells in the leftmost columns in the two sheets, other than saying that the ensuing VLOOKUP would skip over any row that had a blank leftmost cell.
If you can live with that, the way I would go about it is pretty simple:
Copy the columns from one group (omitting the header row) and paste them to the end of other group. Again, since you have mentioned VLOOKUP, I'm assuming that keeping the cells in the rows next to each other is the goal (i.e. you can't remove the blanks in the columns because otherwise that would mess up the horizontal integrity of the cell relationships).
Do your VLOOKUP. Again, I'm assuming unique values in the leftmost column. This assumption is important, because it will make a difference to the decisions you make about what type of VLOOKUP you use (range vs. exact match) and what value is returned. For example, if you use exact match and there are repeating values, it will return the 1st match it finds.
Again, the assumptions might be wrong, but the question is a little unclear.

Resources