Check if date already in a column

z0de

Board Regular
Joined
Oct 22, 2010
Messages
75
Hi all,

I want to check if a user imputed date is already in a column before copying it across.

Sheet1: Input sheet with date in cell B2
sheet2: table of data with dates in column A

what I think I want:
If sheet1 b2 is in column sheet2 column A
then stop.


Any help would be good.
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Is this in VBA?

Code:
If WorksheetFunction.CountIf(Worksheets("Sheet2").Columns("A"), Worksheets("Sheet1").Range("B2").Value) Then
 
Upvote 0
it is vba, that code gives a subscript error.

outside of vba I got countif to work with:
Code:
=COUNTIF('Daily Data'!A:A,Input!B2)
Daily data is sheet5, Input is sheet1.

What I tried:
Code:
If WorksheetFunction.CountIf(Worksheets("Sheet5").Columns("A"), Worksheets("Sheet1").Range("B2").Value) Then
 
Upvote 0
You said that your sheets were nemaed Sheet1 and Sheet2. Try:

Code:
If WorksheetFunction.CountIf(Worksheets("Daily Data").Columns("A"), Worksheets("Input").Range("B2").Value) Then
 
Upvote 0

Forum statistics

Threads
1,224,517
Messages
6,179,240
Members
452,898
Latest member
Capolavoro009

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