#### Counting Non Blank Cells

```I could really use some help with this headache.

I'm using Excel 2003.

I'm doing a Vlookup comparing text data in Column A of Worksheet 1 to text
data in Column C of Worksheet 2.
If there's a match I'm having the result placed in Column B of Worksheet 1.
When there's no match I get a blank which is fine.

I'm comparing about 10,000 records in Worksheet 1 to about 8,000 records in
Worksheet 2.

I need a way to get a count of only the matched records in Column B.

I've tried using the The CountA function for Column B, but I get the exact
same counts in Column B as I have for Column A in Worksheet 1, even though
only about 6,000 records matched.  Is there a way to get this right?  Excel
seems to count all of the cells just because there are formulas in every
cell in Column B.

COUNT doesn't work because I'm not using numerical values, and COUNTBLANKS
isn't finding any blanks in Column B!

Assuming there's a way to do this, I'll then need to compare the records
from Worksheet 2 to Worksheet 1 and get a count of those that match as well.

Thank you so much for your help....AJ

```
 0
ajv001 (10)
3/26/2008 6:54:50 PM
excel.newusers 15348 articles. 2 followers.

6 Replies
658 Views

Similar Articles

[PageSpeed] 47

```In Sheet1, try something like:
=SUMPRODUCT(--(ISNUMBER(MATCH(A2:A10000,Sheet2!C2:C8000,0))))

In Sheet2, try something like:
=SUMPRODUCT(--(ISNUMBER(MATCH(C2:C8000,Sheet1!A2:A10000,0))))

You may want to switch calc mode* to manual before you proceed with the
above. It's quite calc intensive since large ranges are involved. Press F9
to recalc.
*via Tools > Options > Calculation tab (options are there)
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"AJ" <ajv001@cox.net> wrote in message news:VZwGj.368\$yD6.65@newsfe08.phx...
>I could really use some help with this headache.
>
> I'm using Excel 2003.
>
> I'm doing a Vlookup comparing text data in Column A of Worksheet 1 to text
> data in Column C of Worksheet 2.
> If there's a match I'm having the result placed in Column B of Worksheet
> 1. When there's no match I get a blank which is fine.
>
> I'm comparing about 10,000 records in Worksheet 1 to about 8,000 records
> in Worksheet 2.
>
> I need a way to get a count of only the matched records in Column B.
>
> I've tried using the The CountA function for Column B, but I get the exact
> same counts in Column B as I have for Column A in Worksheet 1, even though
> only about 6,000 records matched.  Is there a way to get this right?
> Excel seems to count all of the cells just because there are formulas in
> every cell in Column B.
>
> COUNT doesn't work because I'm not using numerical values, and COUNTBLANKS
> isn't finding any blanks in Column B!
>
> Assuming there's a way to do this, I'll then need to compare the records
> from Worksheet 2 to Worksheet 1 and get a count of those that match as
> well.
>
> Thank you so much for your help....AJ
>
>

```
 0
demechanik (4694)
3/26/2008 7:26:55 PM
```On Wed, 26 Mar 2008 13:54:50 -0500, "AJ" <ajv001@cox.net> wrote:

>I could really use some help with this headache.
>
>I'm using Excel 2003.
>
>I'm doing a Vlookup comparing text data in Column A of Worksheet 1 to text
>data in Column C of Worksheet 2.
>If there's a match I'm having the result placed in Column B of Worksheet 1.
>When there's no match I get a blank which is fine.
>
>I'm comparing about 10,000 records in Worksheet 1 to about 8,000 records in
>Worksheet 2.
>
>I need a way to get a count of only the matched records in Column B.
>
>I've tried using the The CountA function for Column B, but I get the exact
>same counts in Column B as I have for Column A in Worksheet 1, even though
>only about 6,000 records matched.  Is there a way to get this right?  Excel
>seems to count all of the cells just because there are formulas in every
>cell in Column B.
>
>COUNT doesn't work because I'm not using numerical values, and COUNTBLANKS
>isn't finding any blanks in Column B!
>
>Assuming there's a way to do this, I'll then need to compare the records
>from Worksheet 2 to Worksheet 1 and get a count of those that match as well.
>
>Thank you so much for your help....AJ
>

"get a blank"???  In Excel, a "blank" means there is nothing in the cell.  I
assume you have some formula in column B -- and a formula is not a <blank>.

Also, I will assume that your formula returns a null string  ("") and not a
<space> (" ") if there is not a match.  (If you have it returning a string,
then change that.

Given those assumptions, the following formula should return a proper count:

=SUMPRODUCT(--(LEN(B1:B65535)>0))

Note that you cannot refer to the entire column (B:B) in Excel 2003; you can
certainly make the range smaller than I've shown  (e.g. B1:B15000), just so
long as it is "long enough".

--ron
```
 0
ronrosenfeld (3122)
3/26/2008 9:11:37 PM
```Thanks for getting back with me, I'll give this a try later today...

I did come up with a formula on my own that seems to work for ColumnB in
Worksheet1 and it is very quick.

In Worksheet 1, Cell B9451, I wrote the following:

=CountIF(b2:b9450,">?")

This function seems to require that at least one text character has to be
present in order for a cell to be counted for the designated range.

Since my Vlookup in Worksheet1 will be compared to at least 6 other tabs and
bring the results to Worksheet1 columns B through G.  I plan just to drag
the formula across the columns I need.

Then in each Worksheet2 through Worksheet7, where I'm comparing ColumnC of
each individually back to Worksheet1 ColumnA,  I'll place the matched
results to ColumnD.  I'll use the formula above to get those counts.

If all of this works like I hope, I then plan to add a little matrix in a
separate tab to summarize the results and spare the readers of wading
through all of the data.  Heck, I might through in a chart or two while I'm
at it.

This will be a monthly report.  Do you see any reason why my formula won't
do the job?

Thanks again!

AJ

"Max" <demechanik@yahoo.com> wrote in message
news:el0ucd3jIHA.4664@TK2MSFTNGP03.phx.gbl...
> In Sheet1, try something like:
> =SUMPRODUCT(--(ISNUMBER(MATCH(A2:A10000,Sheet2!C2:C8000,0))))
>
> In Sheet2, try something like:
> =SUMPRODUCT(--(ISNUMBER(MATCH(C2:C8000,Sheet1!A2:A10000,0))))
>
> You may want to switch calc mode* to manual before you proceed with the
> above. It's quite calc intensive since large ranges are involved. Press F9
> to recalc.
> *via Tools > Options > Calculation tab (options are there)
> --
> Max
> Singapore
> http://savefile.com/projects/236895
> xdemechanik
> ---
> "AJ" <ajv001@cox.net> wrote in message
> news:VZwGj.368\$yD6.65@newsfe08.phx...
>>I could really use some help with this headache.
>>
>> I'm using Excel 2003.
>>
>> I'm doing a Vlookup comparing text data in Column A of Worksheet 1 to
>> text data in Column C of Worksheet 2.
>> If there's a match I'm having the result placed in Column B of Worksheet
>> 1. When there's no match I get a blank which is fine.
>>
>> I'm comparing about 10,000 records in Worksheet 1 to about 8,000 records
>> in Worksheet 2.
>>
>> I need a way to get a count of only the matched records in Column B.
>>
>> I've tried using the The CountA function for Column B, but I get the
>> exact same counts in Column B as I have for Column A in Worksheet 1, even
>> though only about 6,000 records matched.  Is there a way to get this
>> right? Excel seems to count all of the cells just because there are
>> formulas in every cell in Column B.
>>
>> COUNT doesn't work because I'm not using numerical values, and
>> COUNTBLANKS isn't finding any blanks in Column B!
>>
>> Assuming there's a way to do this, I'll then need to compare the records
>> from Worksheet 2 to Worksheet 1 and get a count of those that match as
>> well.
>>
>> Thank you so much for your help....AJ
>>
>>
>
>

```
 0
ajv001 (10)
3/27/2008 2:50:57 PM
```Thanks, Ron.

As I just replied to Max,  I wrote a little formula that seems to work at
the bottom of ColumnB as follows:

=CountIf(B2:B9450,">?")

It seems to only count cells that contain at least 1 text character, which
is what is needed.

I realize that there are many way to solve tasks in Excel, and I'm not
confident that my solution is bullet proof, but it seems to work.  Any
thoughts whether your or Max's formulas would be safer or more reliable
than mine?

Thanks again for your help and quick response!

AJ

"Ron Rosenfeld" <ronrosenfeld@nospam.org> wrote in message
news:4melu3td42ifnol502bj2qj7dprd9k00vj@4ax.com...
> On Wed, 26 Mar 2008 13:54:50 -0500, "AJ" <ajv001@cox.net> wrote:
>
>>I could really use some help with this headache.
>>
>>I'm using Excel 2003.
>>
>>I'm doing a Vlookup comparing text data in Column A of Worksheet 1 to text
>>data in Column C of Worksheet 2.
>>If there's a match I'm having the result placed in Column B of Worksheet
>>1.
>>When there's no match I get a blank which is fine.
>>
>>I'm comparing about 10,000 records in Worksheet 1 to about 8,000 records
>>in
>>Worksheet 2.
>>
>>I need a way to get a count of only the matched records in Column B.
>>
>>I've tried using the The CountA function for Column B, but I get the exact
>>same counts in Column B as I have for Column A in Worksheet 1, even though
>>only about 6,000 records matched.  Is there a way to get this right?
>>Excel
>>seems to count all of the cells just because there are formulas in every
>>cell in Column B.
>>
>>COUNT doesn't work because I'm not using numerical values, and COUNTBLANKS
>>isn't finding any blanks in Column B!
>>
>>Assuming there's a way to do this, I'll then need to compare the records
>>from Worksheet 2 to Worksheet 1 and get a count of those that match as
>>well.
>>
>>Thank you so much for your help....AJ
>>
>
> "get a blank"???  In Excel, a "blank" means there is nothing in the cell.
> I
> assume you have some formula in column B -- and a formula is not a
> <blank>.
>
> Also, I will assume that your formula returns a null string  ("") and not
> a
> <space> (" ") if there is not a match.  (If you have it returning a
> string,
> then change that.
>
> Given those assumptions, the following formula should return a proper
> count:
>
> =SUMPRODUCT(--(LEN(B1:B65535)>0))
>
> Note that you cannot refer to the entire column (B:B) in Excel 2003; you
> can
> certainly make the range smaller than I've shown  (e.g. B1:B15000), just
> so
> long as it is "long enough".
>
> --ron

```
 0
ajv001 (10)
3/27/2008 2:58:43 PM
```On Thu, 27 Mar 2008 09:58:43 -0500, "AJ" <ajv001@cox.net> wrote:

>Thanks, Ron.
>
>As I just replied to Max,  I wrote a little formula that seems to work at
>the bottom of ColumnB as follows:
>
>=CountIf(B2:B9450,">?")
>
>It seems to only count cells that contain at least 1 text character, which
>is what is needed.
>
>I realize that there are many way to solve tasks in Excel, and I'm not
>confident that my solution is bullet proof, but it seems to work.  Any
>thoughts whether your or Max's formulas would be safer or more reliable
>than mine?
>
>Thanks again for your help and quick response!
>
>AJ

So long as you understand what the formula is doing, and that is what you want,
and it works -- those are the important factors.

Not knowing what sorts of results you are producing in Column B, it's difficult
to go further.

--ron
```
 0
ronrosenfeld (3122)
3/27/2008 7:21:41 PM
```> Thanks for getting back with me, I'll give this a try later today...
No prob, do post back whether the suggestion worked for you as a closure

As for your new query (which should actually be a fresh new posting)
as Ron expressed in his reply to you:
> So long as you understand what the formula is doing, and that is what you
> want, and it works --
> those are the important factors.

--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---

```
 0
demechanik (4694)
3/27/2008 11:06:35 PM

Similar Artilces:

Summing 2 columns cells into a 3rd colums cells
In Excel 2007, I need the to add data from column L's cells 2-93 with the data from column M's cells 2-93 and have it total in Column N's cells 2-93. I'm hoping that there is an easier way than auto summing each pair of cells. This example is the smallest range that I have to due this with and auto summing is to time consuming. Please if you have a formula that I can use it would be extremly helpful. Just in case you haven't notice I'm still in the learning stages.................. -- Thank You, Wayne Cadigan Hi Wayne You can still do this ...

Autofit Merged Cells? Can we do this?
I have a row that has merged column cells. Even if I choose autofit, it will not autofit. Is tehre a way to do this? ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ If you search the group archives: http://google.com/advanced_group_search?q=group:*excel* using "merge autofit" (without quotes) as search terms, you'll find many posts on this topic, including links to a macro by Jim Rech that may work for you. In article <kenji4861.vwe00@excelf...

Non-Scrolling Background inside CScrollView
Hi everybody, i have some problem i am trying to get working the last few days. I derived an scrollview class from csrollview and opened (created) it inside another cformview so that is is behaving like a control). It is similar to the example called ViewInDialog (a scrollable view inside a dialog) from codeguru or codeproject. I want to use this scrollview to list address entries and the view is only vertically scrollable. The view has (should have) a bitmap background. I 've chosen the cscrollview to be able to place buttons (via create) on the view. I want to use the buttons to jump t...

Conditional Formatting
I have read & tried several CF solutions, but they are not working for me. I am working with Today() date, Due_Date, & days_late. I have a formula in the days_late column =IF(OR(TODAY()<Due_Date,J9="COMPLETED")," ",TODAY()-Due_Date). This formula gives me days_late or leaves that column blank (" "). I want 5 cells to turn red if days_late>1. All my attempts at CF have also turned the blank (" ") cells red also. I have tried ISBLANK and NOT(ISBLANK). -- pls Your problem is that " " is not blank. I know it looks...

Cell formating in Excel?
Is there a way to have a scroll bar in a single cell? No. -- Best Regards, Luke M "pmarina" <pmarina@discussions.microsoft.com> wrote in message news:5D25B665-B7B8-477D-AAF8-80A347FFA0DD@microsoft.com... > Is there a way to have a scroll bar in a single cell? ...

Excel-how (find/replace) for multifmat cells w/o changing fmat
For a client, i need to be able to find and replace words in cells with 2 formats. But when you replace them,it changes the format of the whole cell, and not just what you changed. Is there any way to work around this without changing the format after all of the find and replaces? Saved from a previous post, but this one has some wordwrap problems fixed: I think you'd have to keep track of each character's font attributes. This works very slowly, but works: Option Explicit Option Compare Text Type myCharacter myChar As String myLen As Long myName As String myFo...

Pivot table and counting.
I have a pivot table that gives me the number of rides done by a van. I can have the pivot table return the number of rides, but what I need is the number vans that participated for a certain day. Example, it is possible to have 27 trips done by 18 vans, how can I count the number of vans and not addup the van number? Any help appreciated. Thank you, Joe Hi Joe We need a bit more information on how your source data table is set up. What information do you have in each column? -- Regards Roger Govier sacredarms <sacredarms@discussions.microsoft.com> wrote: > I have a pi...

Impossible to delete non-associated mailbox
Hi, I have an Exchange mailbox not associated to any AD user and I can't delete it. It is not marked with the X so the purge option in the context menu is disabled. How can I delete it? Thanks in advance -- Faustino Dina -------------------------------------------------------- If my email address starts with two 'f' drop the first 'f' when mailing me. Hello Faustino: Try this for Exchange 2003: Right click the Mailbox folder under the mailbox store and then select Run Cleanup Agent. You should then see the red X. Regards, Martin MCSA: M "faustino Dina" &...

Changing hyperlinks for a range of cells
Every month I have to update an Excel file which links to another Excel file by hyperlinks.(for instance, the cell "A1" in "monthly03.xls" are linked to the cell "A1" in "Source-Jun03.xls", now I need to link "monthly03.xls" to "Source-July03.xls"). Currently I need to go to every single cell (more than 500 of them) of "monthly03.xls" and change the hyperlinks so as the file is linked to "Source- July03.xls". It is very time-consuming. I believe it can be done by using Macro. However, I do not have any ba...

Cycle Counting
Hello, I am looking for ideas on how to cycle count serial number tracked items without increasing workload. Our serialized items are barcoded but the problem is the are situated on the pallet incorrectly and the pallet is placed on a third level of a racking system. If we could just cycle count based on item count and not include the serial number it would make it easy. Is this possible in Great Plains. We are running Great Plains 8.0. Any suggestions are greatly aprreciated. Thank You, Brian Morris Database Administrator ...

Set RN = Range(Cells(2, 1), Cells(r, 1)) error
What wrong with this. It create error. How can I improve to get rid the error? Set RN = Range(Cells(2, 1), Cells(r, 1)) Thanks Daniel Hi Daniel, Too much missing information - has r been declared and what data type is it and what value does it have. What property of the range are you trying to store in the variable RN? What type of variable is RN and has it been declared. -- Thanks, Shane Devenshire "Daniel" wrote: > What wrong with this. It create error. How can I improve to get rid the > error? > > Set RN = Range(Cells(2, 1), Cells(r, 1)) > &...

Count
Hi, I would like to know how which formula I should use to count some codes & to ignore the duplicated codes, for example in column A: Code 1234 4321 4321 1234 1234 3214 Now, I want Excel to count & the result is 3 which are: 1234-4321-3214 Yes I can use PivotTable, but I would like to use a formula because I have to deal with this every day. I appreciate your support. -- MFS22 COUNTIF will do it. =COUNTIF(Rng,Rng), where the criterion is the same as the range: e.g =COUNTIF(A3:A8,A3:A8) HTH Peter "MFS" wrote: > Hi, > I wo...

change highlight color on active cells
How do I change the active highlight color of an active cell. Louis Only though VBA. Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) Static OldCell As Range If Not OldCell Is Nothing Then OldCell.Interior.ColorIndex = xlColorIndexNone End If Target.Interior.ColorIndex = 6 'yellow Set OldCell = Target End Sub This is sheet event code. Right-click on the sheet tab and "View Code". Copy and paste into that module. Chip Pearson has a great add-in named Rowliner.xla that will make the highlighting available for all sheets and workbooks. The code above w...

How do I count the # of times a value reoccurs and plot it over ti
I wish to plot a number of errors made by each users and compare it over time. I have a column of user ID's and a column of dates. I want the chart to count the number of times each user ID appears and plot against it's corresponding date. However, each time I try to do this, the chart appears wrong. Any ideas? In article <9595B2A1-8282-4AB3-8511-A6776E108164@microsoft.com>, Stephen@discussions.microsoft.com says... > I wish to plot a number of errors made by each users and compare it over > time. I have a column of user ID's and a column of dates. I want t...

format cells #4
hi. how can i set by default the cell formatting to 'general' or 'number' or even 'text'? i mean i dont want excel to correct let's say: 1.5 to 01.may or 9/12 to 09.dec. is this possible? thanks. (i have some programs which export data to excel and instead of numbers in excel appear dates and i can't set the cell format before the data is exported) -- notrace2004 ------------------------------------------------------------------------ notrace2004's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=34817 View this thread: http://www....

Formatting cells in Excel with Ascending/Descending order
I am trying to insert a drop down asceding/descending arrow in the cell of the excel document. When you click on the arrow which is a small box on the right side of the cell, it will organize all figures/data in that column and you can choose between ascending/descending, or how you want to organize it. Thank you -- Andrew ...

Populate Blank Fields with "0" based on checkmark.
I have a form with 20 fields. The user enters data into some but not all of the fields depending on where they collected data. Is it possible to create a checkbox where, after the user enters their data, they click the checkbox, and any of the 20 fields that are blank get populated with a 0? Thanks for the help. Is there any reason you want them to be zero? If they are numeric fields, you can set the default to zero in table design view. There is no need to use a checkbox, you can arrange it so any empty fields are converted to zero when you move to another record or exit th...

Line count
I am working with a program called Dictaphone. We use Word 2007 in this program. The line count on Dictaphone and the line count in Word 2007 are different even though the Dictaphone text is retrieved from Word 2007. Why would they be different? What is the difference between virutal line count and physical line count? ...

count number of characters in rich edit control
How can i count number of characters in rich edit control 2 If u mean controls of type Rich TextBox control, try RichControl1 RC1; CString Mes=RC.GetText(); int n=Mes.GetLength(); "Rahul" <Rahul@discussions.microsoft.com> wrote in message news:7743023C-EA83-4ACA-AB67-F1AE7279F1EB@microsoft.com... > How can i count number of characters in rich edit control 2 EM_GETTEXTLENGTHEX, WM_GETTEXTLENGTH, WM_GETTEXT, EM_STREAM* "Rahul" <Rahul@discussions.microsoft.com> wrote in message news:7743023C-EA83-4ACA-AB67-F1AE7279F1EB@microsoft.com... > How can i co...

Extra Blank Lines
The following macro imports a text file and sorts horse races in time order and puts a blank line in between each race time (which is at the end of the code), which it does admirably. I had some valuable help with this project from group members recently. However, it does create quite a few blank lines en bloc. It's not really a problem, as I search them out and do a delete. Below is the code which a member might use in order to find the cause of the blank lines? Sub Macro1() Range("A2:J601").Select Selection.ClearContents Range("A2").Select ...

Counting sales
I have two different datasets. Each with a common identifier. I need a formula that will reference the identifiers in both datasets and count the number of sales a particular agent made. Example. look up this identifier in the other dataset and then give me the value that is 2 columns over from the identifier in the second dataset. See if this helps: http://contextures.com/xlFunctions02.html -- Biff Microsoft Excel MVP "Dave" <Dave@discussions.microsoft.com> wrote in message news:E7245B37-033F-400E-9CEE-9822BE7CB0F5@microsoft.com... >I have two...

Trying to open a blank document
Every time I open Word a particular document opens with it. I seem to be unable to open a blank document. I deleted the document that appears every time I open Word and still that same document is there when I open Word and /or a new blank page on Word. Any advice on how to correct this? See http://word.mvps.org/faqs/apperrors/blankdocnotblank.htm. -- Stefan Blom Microsoft Word MVP "Chairlady1" <Chairlady1@discussions.microsoft.com> wrote in message news:C7D6D85F-9ED4-4D23-944A-8A977F9F672A@microsoft.com... > Every time I open Word a particular docum...

How to retrieve value from specific cell value?
Does anyone have any suggestions on how to retrieve value from specific cell value with specific worksheet? I would like to create a if-statement within macro, If specific cell within specific worksheet = 1 then process following code End If Does anyone have any suggestions? Thanks in advance for any suggestions Eric hi If Sheets("sheet1").Range("A1") = 1 Then MsgBox "run code" Else MsgBox "skip code" End If regards FSt1 "Eric" wrote: > Does anyone have any suggestions on how to retrieve value from specific cell &...

Counting Cells with Conditional Formatting
Is there a way to look at a row of data that is either highlighted yellow or red and to count only the data that is highlighted yellow and give me that number? None of my data is numerical....just one letter data, i.e.: "S" or "U" I just want to count how many of the cells are highlighted yellow in a specific row, if that makes more sense. Here's a UDF (Put in a Standard module) and use it in cell A1, like =CountByColor(A8:H8,6) << where 6 (at present) = Yellow = change to =CountByColor(A8:H8,3) to get the reds HTH Function CountByColor(InRa...

COUNT ? need formula
Hi, I want to track the results of my teams sales performance. I record if it is a sale, no sale, cancelled etc in column M. I thought I'd be able to use the COUNT function/formula to be able to search for all the SALES in column M and place the result in a cell ( column O )but I can't work it out. Any ideas? Damian Hi! Try this: =COUNTIF(M1:M100,"sale") Biff "Diamond Jones" <kwanzaNOSPAM@optusnet.com.au> wrote in message news:43a0e897\$0\$17704\$afc38c87@news.optusnet.com.au... > Hi, > > I want to track the results of my teams sales perf...