#### 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
1604 Views

Similar Articles

[PageSpeed] 28

```"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:

Can you insert a picture into a specific cell?
Or do they only "float" on the page. Marc They float over the worksheet, but you can adjust the size so that it seems to fit a cell exactly. If you insert a picture, you can hold the alt-key down while you move/resize the picture. When it gets close to the edge of a cell, it'll snap-to that edge. Marc wrote: > > Or do they only "float" on the page. > > Marc -- Dave Peterson ...

double clicking and draging a column in a chart to chg data
in Excel 2003, double clicking on a column in a chart and then dragging the column up or down would change the data in a table upon which the chart depended. How does one do this in excel 2007? Tom Hi, That feature has been removed in 2007, there is no way to do it. If this helps, click the Yes button. -- Thanks, Shane Devenshire "Tom of inns" wrote: > in Excel 2003, double clicking on a column in a chart and then dragging the > column up or down would change the data in a table upon which the chart > depended. > > How does one do this in excel 2007? &g...

transfer data from multiple columns to singlr column
I have data in form a d g b e h c f i (but larger scale) and I need it in a single column going a to z. Hi, highlight you data, copy, go to the column where you want to see the data, paste special, transpose "lc85" wrote: > I have data in form a d g > b e h > c f i (but larger scale) > and I need it in a single column going a to z. You up for using a macro? Sub ToOneColumn() 'dantuck Mar 7, 2007 &...

update column
How would I update a column with numeric values so that there are 3 leading zeros for each row? hi it is not possible to add leading zeros to a numeric value. Mathematically, this is redundent and unnecessary. "brian" wrote: > How would I update a column with numeric values so that there are 3 leading > zeros for each row? opps. hit the post button too quick. option 1. custom format if your numeric value is 12345 then see the custom format to 00000000. note. format do not change data - it just changes the way it looks in the cell. option2. format to text then use the c...

Can't insert Char(1) into SQL Server from Stored Procedure
Hello I am trying to insert a char(1) field into a table from an ASP.Net/C# application. At first I was inserting rows into the table but none of the columns that I was inserting the rows into were char(1) columns, they were mostly int and varchar columns. Then I found out that there was one column in the list that was not supposed to be an int column but instead it was supposed to be one of the char(1) columns into the table. So I replaced the int column in the list with the char(1) column and since the value of the char(1) column resulted from a CheckBox ('Y...

Oldest date for Duplicate Cust. #
I'm trying to get the oldest date associated with a customer number, and in the Cust# column, i'll have many duplications of the same customer number. Let's say A is "Date", and B is "Cust#". (I won't be able to allow my users to sort the data, so i'll need a formula that returns either the oldest date, or the cell which contains the oldest date.) Any help is much appreciated! Nevermind. I found it using Google/Groups. {=MIN(IF(\$B\$1:\$B\$10=B1,\$A\$1:\$A\$10))} >-----Original Message----- >I'm trying to get the oldest date associated with a...

Joining text with a formula in cell #4
just to complete the thread... I found the answer. You have to change the format of the cell to custom 0.00"*" this is the only way it will show only 2 decimal places Thanks for the hel -- Mustard Hea ----------------------------------------------------------------------- Mustard Head's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1630 View this thread: http://www.excelforum.com/showthread.php?threadid=27700 ...

Global Column Row Preview Font Size
I know I can change the column, row and preview font size for the current email folder's view, but how do I do it for all of the email folders? I have loads of email addresses each with lots of folders. I don't want to have to do each one at a time. Surely there must be a default font setting (even if it's only in the registry)? Thanks in advance, Tim. I too would love an answer to this. Ian "Timie Milie" <tim_milstead@yahoo.co.uk> wrote in message news:45782ee8\$0\$27107\$db0fefd9@news.zen.co.uk... >I know I can change the column, row and preview font ...

Dates #9
The problem of a date code... I need to address this so that fo example, 5/6/04 can be correctly entered as either 5th of June or 6t of May, depending from where the date emanted. regards -- Message posted from http://www.ExcelForum.com Couldn't you format the cell as mmmm dd, yyyy so that the user sees what date they entered in a non-ambiguous manner right away? Or maybe provide 3 inputs: Month, day, and year. You could combine them elsewhere. "adn4n <" wrote: > > The problem of a date code... I need to address this so that for > example, 5/6/04 can be c...

Single click selects multiple cells
When clicking on a single cell multiple cells are selected. The one time solution for this is to zoom in or out. This is problematic as 60% seems to be the zoom that works most of the time but at this zoom level the cell contents do not display. The time lost and the frustration that builds is killing my productivity and office attitude. Please give all of us a permanet fix. -- Thanks Mike ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" butt...

Qrp Date functions
Where do I find the various functions to modify the Reports like cast(DatePart(Dd,[Transaction].Time) as nvarchar) and others and what they mean???? Barry Found the information at MSDN Transact-SQL Reference Barry "Barry L" <barryl@eryanjewelers.com> wrote in message news:usd3uP1CIHA.1188@TK2MSFTNGP04.phx.gbl... > Where do I find the various functions to modify the Reports > like cast(DatePart(Dd,[Transaction].Time) as nvarchar) and others > and what they mean???? > > Barry > ...

Referencing cells across sheets
Hi, I've created a workbook with three sheets. The first three columns of sheet 2 and sheet 3 are referenced to the first three columns of sheet 1. What I'd like to do, is set the workbook up so that if I insert a row before, between or after referenced rows in sheet one, a row will also be inserted, and referenced, in the corresponding place on sheets 2 and 3. Does anyone know how to do this? Also, if no data is entered into a cell on sheet one, the value shown in the corresponding cells of sheets '2' and '3' is '0'. I need those cells to remain bla...

Copying Data in a cell in one sheet to a cell in another sheet
I've run into a problem trying to copy data from a cell in one sheet to another. I have a spreadsheet called "rating" which contains a number of formula that calculates a final number. I also have a spreadsheet called "Final" that copies over the information from "Rating". In "Final", I'm trying to copy a number from "Rating" into a particular cell. I put in =Rating! G89, but it won't work. When I press enter, a window pops up "Update value:Rating". I press enter again and in the cell where I want the number ...

How to unlock locked cells by MACRO?!
I have locked Sheet and I need to change particular cells. But when my macro wants to change it => ERROR :/ Is there any way to unprotect these particulary cells by macro and change them? - after that action, of course, I want to lock them again. Please help me, Pedro Just unprotect the sheet, do the work, and reprotect the sheet. Kind of like: activesheet.unprotect password:="yourpassword" 'your code to change stuff activesheet.protect password:="yourpassword" Petr N�me�ek wrote: > > I have locked Sheet and I need to change particular cells. But when m...

date tracking
I am entering clients into a 2007 Excel spreadsheet. How do I make the entry turn color when 14 days have passed? Gene This is a multi-part message in MIME format. ------=_NextPart_000_0018_01CAC8D4.5688AC60 Content-Type: text/plain; format=flowed; charset="UTF-8"; reply-type=original Content-Transfer-Encoding: 7bit As part of the "client" entries, do you enter the date the client was entered? This would be the key in doing this task. In a cell on the worksheet you could enter the formula for today's date like this =TODAY(). Then use the con...

Short time vs short date
In my form I have a fldOutOfRoom which the user inputs a short time into the field, i.e, 0900. I have the following code in the open event of another form called frmRNnotes: If DateDiff("h", Forms!frmPtDemographicNew!frmVisitNewEdit.Form!OutOfRoom, Now) >= 1 Then Me.cmdRNnotesEdit.Visible = False This code gives the RN one hour to complete a note and then he/she can no longer edit the note. What I want to know is the Short Time format going to let the cmdRNnotesEdit button be visible everyday within one hour of the of the original time? That is, is the short time just a tim...

How to add a button to restore all altered cells original values?
I want to add a reset button to an excel spreadsheet that will restore the values of all changed cells to the original saved ones. Any help would be appreciated. Thanks Dawn Hi this would require quite some VBA code as you somehow have to store the original values for example on a separate hidden sheet -- Regards Frank Kabel Frankfurt, Germany "Dawnybros" <Dawnybros@discussions.microsoft.com> schrieb im Newsbeitrag news:3340601E-16EE-4296-8F50-B0BAC18EA387@microsoft.com... > I want to add a reset button to an excel spreadsheet that will restore the > values of all ...

How do I insert space between 2 consecutive columns of an XL Shee.
I want to have space between two consecutive columns of a worksheet (of course, without having inserted another column between the two) in order to have separated the Border Lines of the adjacent cells/columns. Please guide me if it can be done in XL. Can you achieve the effect that you're looking for by using a double vertical border down the right side of the left column and having no border down the left side of the right column? Rgds, ScottO "Shamshad Butt" <Shamshad Butt@discussions.microsoft.com> wrote in message news:1222EE13-11A9-4354-9F12-D1F1155D3902@microsof...

Can i use conditional formating on a cell when it contains a formula?
I am trying a "conditional formatting" on a cell that contains formula, but it didn't work. "If cell value is equal to 0 then font - white" This doesn't work, stays always. If i use this condition on a cell without formula it works just fine. Thank -- si ----------------------------------------------------------------------- sit's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=262 View this thread: http://www.excelforum.com/showthread.php?threadid=26784 Hi are you sure your formula returns an exact zero?. Could you post the formul...

Date Calculation
Good Afternoon, I have a DB which tracks training of employees. The grace periods allowed with the training is that new training can be completed within 90 days of the expiry date without changing the anniversary date (e.g. the training is due on 1 April 2010, the employee conducts the training on 2 January 2010 but gets to keep the 1 April anniversary date). The table I am working with is mainly based on the date of training and the training type (which determines whether the training expires on the 1st of the 13th, 25th or 37th months or if it keeps the same date); what I w...

date modified
I have two sheets Data and Summary The "data" sheets macro extracts data from external file and paste into "Data" sheet Everytime the m acro is run to get latest data... The macro delete all contents of the "data" and then paste new data into the "data" sheet. Is there a way.. I can put a date on the "summary" sheet, when was the time the macro was run ( or in other words.. the data updated) This little macro records the date in the selected cell and formats it: Sub Macro2() Dim d As Date Dim s As String d = Now() s...

Date function quit working
Hi, I have an Access 2002 application that I have been running on Windows XP SP2 without issue. I just installed the application (running in Access Runtime) on a Windows Vista Home Premium machine. Now, anywhere I used the =Date() function, it fails and just shows #Name? I also have a subform on one of my forms that has now gone blank. It also uses the date function. I had this problem when I converted to Windows XP several years ago and updating the OWC10.dll to version 6619 fixed both issues. However, everything I have read says that reference file makes no difference to the Access...

Using INDIRECT within functions
I learned a bit from JLathman in a previous post but tried to use the same methodology with this formula (also learned from this Group to get the last entered value in a column) without much luck. The original formula was this with 2009 sheet being static: =LOOKUP(2,1/('2009'!H3:H65536<>""),'2009'!H3:H65536) Trying to make it dynamic I tried the following without success: =LOOKUP(INDIRECT("2,1/(" & O1 & "!\$H\$3:\$H\$65536<>"")," & O1 & "!\$H\$3:\$H\$65536)")) Did I miss something or are...

Cell with large amount of data not showing all data
I'm running Excel 97. I have a cell with 358 words (1928 characters with spaces). Word wrap is on for the cell. Only part of the text is displayed even though the cell is big enough to show everything. If I make the cell wider (wider than a page) more of the text shows but not everything. I tried a new worksheet with the same text and had the same problem. Is this a known issue with excel? Is there a solution? Thanks, Brad Left to its own devices, excel will only show about 1000 characters in a cell. But you can add some alt-enters (to force a new line within the cell) and see more s...

Date format 04-11-06
Hi, Is there a possibility that the dates used in all the entities are not in the default format mm/dd/yyyy but in dd/mm/yyyy. I already adapted the Organisatonal settings, that only adapts the journal but nog the dates of an appointment. Does anyone have an idea? Thanks, ...