excel custom data valadation with countifs

Alwinaz

Board Regular
Joined
Feb 7, 2012
Messages
201
Hi there

I posted a thread earlier it looks lik it was wrorking but it now appears not working.

Can you use countifs in custom data valadation my formula that i want to use is =COUNTIFS($B$4:$B$50000,"="&B4,$AO$4:$AO$50000,"="&AO4)=1 Can any body help me?
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
What i am trying to do is to prevent the user to enter a claim number in column b more than once a day. So in column b the user will enter the claim number. once the claim number is entered i want data valadation to check if this claim number already exist for this date (column AO), if so it must give a error message. The problem is even if i enter a unique number it gives me the error message.
 
Upvote 0
The formula works for me. Are you sure that you have applied the validation to the correct range (B4:B50000 with B4 the active cell)? if you put the formula in a spare column on your worksheet does it return what you expect?
 
Upvote 0
Also, in the DV dialog, Settings tab, make sure that you have not removed the tick from "Ignore blank"


BTW, you don't need those "=" in the formula.
=COUNTIFS($B$4:$B$50000,B4,$AO$4:$AO$50000,AO4)=1
 
Upvote 0
is it perhaps possible that it is not working due to the fact that i have a vba that time stamp the cell in ao once cell b is updated?
 
Upvote 0
For your Data Validation in column B to work, the date would need to be in column AO before the value is entered in column B. Alternatively, you could build the data validation into your time stamp code.
 
Upvote 0
i am using this VBA to date stamp. I can not write VBA's but i can modify them to work. how will i change this vba to include the data validation?

Code:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)


If Intersect(Target, Columns("B:B")) Is Nothing Then Exit Sub
For Each C In Intersect(Target, Columns("B:B"))
    If C.Value <> "" Then
        C.Offset(0, 38).Value = Format(Now, "dd-mmmm-yyyy h:mm")
    Else
        C.Offset(0, 38).ClearContents
    End If
Next C

End Sub
 
Upvote 0
That code is writing to column AN not AO. Also, it's writing the date and time, so there are unlikely to be duplicates.
 
Upvote 0
in column ao i have the value of AN as i had problems with the value as inserted in AN in other formulas.
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,964
Members
452,371
Latest member
Frana

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top