# Formula to Count Unique Values in Column based on Date Ranges in Another

#### jonnycuest

##### New Member
Hello,

I am looking to count unique values in 1 column with criteria that involves date ranges from TODAY()-30 and TODAY() in another column.

Unique Values in Column D:D
Date Ranges in Column V:V which need to fall between TODAY()-30 and TODAY

I can't figure out how to get both of these working together in one formula.

Thank you!

#### jonnycuest

##### New Member
I'm comparing it to the solution provided and I'm not seeing any brackets out of place. Can you advise?

=IFERROR(ROWS(UNIQUE(FILTER(A2:A10,(LEFT(B2:B10,10)+0>TODAY()-1)*(LEFT(B2:B10,10)+0<TODAY())))),0)
=IFERROR(ROWS(UNIQUE(FILTER('CF - MM Main'!D:D,(LEFT('CF - MM Main'!V:V,10)+0>TODAY()-1)*(LEFT('CF - MM Main'!V:V,10)+0<TODAY())))),0)

These have the brackets in the same place

### Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

#### Fluff

##### MrExcel MVP, Moderator
oh okay thanks. I was googling ROWS. My bad
That would explain it.

#### Fluff

##### MrExcel MVP, Moderator
These have the brackets in the same place
My eyesight must be playing tricks on me. You're quite right.

It maybe that either there are no dates that match the criteria, or the values in col V are not being recognised as dates after taking the 1st 10 characters.

#### jonnycuest

##### New Member
Thanks,

So the values in that column are general text exported from another system. They look like this: 2021-07-13 12:19:04 UTC
The formula should be picking them up.

I am kind of stumped.

I've even split them into a column with just the date and it's still not counting correctly.

#### Fluff

##### MrExcel MVP, Moderator

Ok, when I added the IfError, I obviously change the formula for some reason, it should be Today()-30 not -1

#### jonnycuest

##### New Member
Oh that's not really the issue. I am using -1 and -30 and -365 in different iterations of this formula. I have checked the -1 and it should be adding up to 2. It is showing 0. Just FYI.

#### Fluff

##### MrExcel MVP, Moderator

Well the -1 will always result in 0 as a date cannot be greater than 13 Jul AND less than 14 Jul

#### jonnycuest

##### New Member
oooooh, there it is. Is it possible to add > or = to this equation?

#### jonnycuest

##### New Member
oh nvm, I just did -2 and called it a day. thank you. sheesh. my bad for wasting so much time. I get it now.

#### Fluff

##### MrExcel MVP, Moderator
Glad it's sorted & thanks for the feedback.

Replies
4
Views
100
Replies
2
Views
460
Replies
3
Views
253
Replies
9
Views
304
Replies
5
Views
74

1,147,734
Messages
5,742,863
Members
423,760
Latest member
photogfrog

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back