Function to work out if a date is equal to another

dpaton05

Well-known Member
Joined
Aug 14, 2018
Messages
2,352
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have the date stored in A1 and a formula in another cell

Excel Formula:
=IF(A1="1/01/*",10,200)

I want the value in the other cell to be 10 if the date is the on new years day for any year and 200 if it is not. What is wrong with my function?
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
A wildcard does not work in a test for equality. When working with dates, use date functions rather than trying to deal with them as text.

Excel Formula:
=IF(AND(MONTH(A1)=1, DAY(A1)=1), 10, 200)
 
Upvote 0
I thought I could just adjust the references but that is not working. The date is part of a table with the header being Date.
The function I had was

Excel Formula:
=IF([Date]="1/01/*",10,200)
 
Upvote 0
Actually, I tried it again and got it to work with this function.

Excel Formula:
=IF([Date]=DATE(YEAR([Date]),1,1), 10, 200)

Thanks guys.
 
Upvote 0

Forum statistics

Threads
1,215,432
Messages
6,124,856
Members
449,194
Latest member
HellScout

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