#### Count Unique Cells, within a date range (dates stored in separate column).

```Hello All:

I am attempting to create a formula that will count the number of
unique cells (alpha-numeric) in an entire column (no set length, so
ex: "\$B:\$B"). This count will be based on a date range (Between 2
dates). The dates are stored in another column (Ex: "\$A:\$A"). The
following is an example of the cells.

Dates          PO_Num
1/2/2010      A123456
1/3/2010      B453453
2/2/2010      A123456
3/4/2010      C2342F3K
4/3/2010      123456

I would like to know a formula that can count the number of different
PO's based on a given date range.

code, please post as well. Any help is welcome.

Matt
```
 0
7/14/2010 2:35:35 AM
excel 39879 articles. 2 followers.

3 Replies
713 Views

Similar Articles

[PageSpeed] 15

```"Matt" <mattehanlon@gmail.com> wrote in message news:59180262-a2f9-499b-9941-7cc2dd301ff7@i28g2000yqa.googlegroups.com...
> Hello All:
>
> I am attempting to create a formula that will count the number of
> unique cells (alpha-numeric) in an entire column (no set length, so
> ex: "\$B:\$B"). This count will be based on a date range (Between 2
> dates). The dates are stored in another column (Ex: "\$A:\$A"). The
> following is an example of the cells.
>
> Dates          PO_Num
> 1/2/2010      A123456
> 1/3/2010      B453453
> 2/2/2010      A123456
> 3/4/2010      C2342F3K
> 4/3/2010      123456
>
> I would like to know a formula that can count the number of different
> PO's based on a given date range.
>
> code, please post as well. Any help is welcome.
>
>
> Matt

Hi Matt.

C1, D1 the limit dates

Try this formula trick:
=SUMPRODUCT(1/COUNTIF(B2:B6,B2:B6)*(C1<=A2:A6)*(D1>=A2:A6)*(""<B2:B6))

to count how many different text PO_Num's there is in B2:B6
Duplicates each count for 1/2, triplicates for 1/3 ...

Hans T.
```
 0
Hans
7/14/2010 4:34:46 AM
```On Jul 14, 1:34=A0am, "Hans Terkelsen" <dk> wrote:
> "Matt" <mattehan...@gmail.com> wrote in messagenews:59180262-a2f9-499b-99=
> > Hello All:
>
> > I am attempting to create a formula that will count the number of
> > unique cells (alpha-numeric) in an entire column (no set length, so
> > ex: "\$B:\$B"). This count will be based on a date range (Between 2
> > dates). The dates are stored in another column (Ex: "\$A:\$A"). The
> > following is an example of the cells.
>
> > Dates =A0 =A0 =A0 =A0 =A0PO_Num
> > 1/2/2010 =A0 =A0 =A0A123456
> > 1/3/2010 =A0 =A0 =A0B453453
> > 2/2/2010 =A0 =A0 =A0A123456
> > 3/4/2010 =A0 =A0 =A0C2342F3K
> > 4/3/2010 =A0 =A0 =A0123456
>
> > I would like to know a formula that can count the number of different
> > PO's based on a given date range.
>
> > Please help me if you can. If there is no formula but there is VB
> > code, please post as well. Any help is welcome.
>
> > Thank you in advance,
>
> > Matt
>
> Hi Matt.
>
> C1, D1 the limit dates
>
> Try this formula trick:
> =3DSUMPRODUCT(1/COUNTIF(B2:B6,B2:B6)*(C1<=3DA2:A6)*(D1>=3DA2:A6)*(""<B2:B=
6))
>
> to count how many different text PO_Num's there is in B2:B6
> Duplicates each count for 1/2, triplicates for 1/3 ...
>
> Hans T.- Hide quoted text -
>
> - Show quoted text -

Hello:

Thank you for the reply. Your formula works great for a small amount
of data. I'm dealing with anywhere from 100 to 95000 rows. The formula
just takes too long to compile.

I think I'm going to have to seek VB code in order to find an
efficient way of getting what I am looking for.

Again, thank you for the reply, but I'm still looking.

-Matt
```
 0
7/14/2010 6:52:52 PM
```"Matt" <mattehanlon@gmail.com> wrote in message news:6bd97f6e-0739-4207-9a5c-6ae2268da5b0@j2g2000vbo.googlegroups.com...
On Jul 14, 1:34 am, "Hans Terkelsen" <dk> wrote:
> "Matt" <mattehan...@gmail.com> wrote in messagenews:59180262-a2f9-499b-9941-7cc2dd301ff7@i28g2000yqa.googlegroups.com...
> > Hello All:
>
> > I am attempting to create a formula that will count the number of
> > unique cells (alpha-numeric) in an entire column (no set length, so
> > ex: "\$B:\$B"). This count will be based on a date range (Between 2
> > dates). The dates are stored in another column (Ex: "\$A:\$A"). The
> > following is an example of the cells.
>
> > Dates PO_Num
> > 1/2/2010 A123456
> > 1/3/2010 B453453
> > 2/2/2010 A123456
> > 3/4/2010 C2342F3K
> > 4/3/2010 123456
>
> > I would like to know a formula that can count the number of different
> > PO's based on a given date range.
>
> > Please help me if you can. If there is no formula but there is VB
> > code, please post as well. Any help is welcome.
>
> > Thank you in advance,
>
> > Matt
>
> Hi Matt.
>
> C1, D1 the limit dates
>
> Try this formula trick:
> =SUMPRODUCT(1/COUNTIF(B2:B6,B2:B6)*(C1<=A2:A6)*(D1>=A2:A6)*(""<B2:B6))
>
> to count how many different text PO_Num's there is in B2:B6
> Duplicates each count for 1/2, triplicates for 1/3 ...
>
> Hans T.- Hide quoted text -
>
> - Show quoted text -

Hello:

Thank you for the reply. Your formula works great for a small amount
of data. I'm dealing with anywhere from 100 to 95000 rows. The formula
just takes too long to compile.

I think I'm going to have to seek VB code in order to find an
efficient way of getting what I am looking for.

Again, thank you for the reply, but I'm still looking.

-Matt

Matt,

Actually scratch my first effort, it was not fully thought through.

And about using the COUNTIF over ~100,000 lines,
the calculation time goes as the sqare of the number of lines.
That is a lot.

A way around could be to get Laurent Longres free Add-In Morefunc from
http://xcell05.free.fr/

It has a lot of valuable functions, for example COUNTDIFF

I have tried with 50,000 lines of data the formula
=COUNTDIFF(INDEX(B:B,MATCH(C1-1,A:A)+1):INDEX(B:B,MATCH(D1,A:A)))
and it was not noticeably slow.

Dates in A:A sorted
PO_Nums in B:B
Limiting dates in C1, D1

This means that a tailormade function, if available, would also be fast.

Hans T.
```
 0
Hans
7/15/2010 8:59:51 AM

Similar Artilces:

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...

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? ...

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 ...

Store Operations POS Item Table Field Suggestion
We would like to suggest adding a new "numeric" type field in the "Item" table of Store Operations. All of the customers that we have dealt with have only used numeric values in the "ItemLookupCode" field, however this field is an alphanumeric string, and does not offer true numeric sorting in applicable browsers. Not to alienate those clients that use alphanumeric characters in the ItemLookupCode field, we suggest adding several true numeric fields for custom data, then the user could sort on their numeric data. In addition to our encounters with numeri...

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)) > &...

To keep in just one cell all values related to a monthly rate
I have to update in a monthly basis a currency rate. I know that there is a function, formula (or something like that) to link a month descripton to a number. e.g. September09 1,325 October09 2,235 November09 1,258 I would like to select correspondent month and the cell be updated with the value. Data Validation dropdown list for choosing the month combined with a lookup table and VLOOKUP function. For help on creating data validation dropdown lists see Debra Dalgleish's site. http://www.contextures.on.ca/xlDataVal01.html For help on VLOOKUP to populat...

Can I limit a cell to 2 characters?
Is there a way in Excel to limit the number of characters in a cell? Thanks Frank By checking the length of the cell =LEN(A1)=2 in your custom validation. Look for Data Validation on Debra Dalgleish's site. --- HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001] My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm Search Page: http://www.mvps.org/dmcritchie/excel/search.htm "Frankc" <Frankc@discussions.microsoft.com> wrote in message news:842747F1-1792-4BB5-B3CE-707C7CC5F88F@microsoft.com... > Is there a way in Excel to lim...

Openning Grouped Columns in Protected Sheets
We want to put such a protection to the sheet that, the protection will not prevent the user from openning grouped columns. This is possible only through a macro, for example: Sub a() With Sheet1 .EnableOutlining = True .Protect , True, True, True, True End With End Sub This setting does not get saved with the workbook, so it must be reset by running this macro each time the workbook is opened. -- Jim Rech Excel MVP ...

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....

WHat file extension are 'tasks' stored in?
We have a user who has had a problem on his laptop and now cannot find his Outlook 2002 tasks. Are they stored in a .pst file or in some other file? Thanks, Brad "Brad Pears" <donotreply@notreal.com> wrote in message news:e0NMyPlTEHA.3872@TK2MSFTNGP10.phx.gbl... > We have a user who has had a problem on his laptop and now cannot find his > Outlook 2002 tasks. Are they stored in a .pst file or in some other file? > > Thanks, > > Brad > > They are included in the pst file. ...

Linking a defined range to a picture in PowerPoint
Hi, I know this is a long shot, but I'm hoping SOMEBODY has the answer.... I need to create a power point presentation that links to an excel workbook. The reason I need to link it is because the numbers will change monthly, and the presentation is distributed monthly. So, I need to create a presentation that will: 1) have excel worksheets in it that link to defined ranges in a workbook. 2) HOPEFULLY have the Pow.Pt. worksheet appear as a bitmap (if not thats ok) 3) allow the Pow.Pt. SS (or the picture) to link to the SS so that the image will change every month. I know it'...

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...

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...

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 ...

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...

subscript out of range error
My program went down with on error in the code. I fixed that error an tried to re-run it. When I go to re-run the program I get a subscrip out of range error when I try to open a worksheet that I know exists. If I close the workbook and re-open it the subscript out of range erro doesn't show up. Below is the code. With Worksheets("ListBox Data").Range("A2") workbook_row_cnt = Range(.Offset(0, 0) .End(xlDown)).Rows.Count For i = 0 To workbook_row_cnt - 1 If .Offset(i, 0) <> "" Then sales_group_cnt = sales_group_cnt + 1 End If Next i End With ...

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...

Date range for a report
Hi I am trying to run a query and can't seem to nail down the right code. We use the access database to track files, incoming/outgoing correspondence dates etc. I am trying to run a query that show me files with dates in a follow up field of -60 days to +7 days, so essentially any follow ups missed in the last 2 months and up coming in the next week. This report is run on a weekly basis. Appreciate any help Thanks Assuming that the follow up field is actually a date/time data type, try this in the criteria: Between Date() - 60 and Date() + 7 -- Jerry Whittle, ...

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 &...

Mobile sync crashes Information Store service
Folks WM5 sync produces a 9673 event to be logged, crashing the Information Store service. Description in the event log: An exception with code 0xc00000fd was thrown in module C:\WINDOWS\system32\ntdll.dll; some parameters and their values were <Exception address - 7e840fdb>. A significant section of the call stack is in the data section. Fully patched E2K3 SP2 on Win2K3 SP1 OWA works fine - well - while the IS is up, but OMA is broken somewhere... Service restarts happily each time, and I've set the recovery options on the service to restart after one minute, but my (inter...

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...

Auto date range updating in Charts
I would like to know how to write a formula that can be typed into an excel chart's category labels box and series values boxes to search for and update ranges to a specific range, such as one year's worth of row entries. In this way, each time a new date and set of entries are made into the spreadsheet, the accompanying chart would update to the new range (last date). I have tried using named formulas to accomplish this, but I have so many spreadsheet in the workbook, that this becomes unwieldy. Any suggestions would be greatly appreciated. thanks, Hi Dave, > I have t...