# Date in Formula

#### Jan Wachowski

##### New Member
Problem is

C11 = 31/10/2002
C12 = 212
C14 = C11+C12 (RESULT IS 31/05/2002)
C16 = IF(C4="31/05/2002","31/05/2002",1)

THE RESULT I GET FOR C16 IS 1, WHEN I EXPECT IT TO BE 31/05/2002.

WHAT IS WRONG WITH MY FORMULA?

THANKS JAN

### Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a \$25,000 loan, 5% annual interest, 60 month loan.
I think change the C4 in your last formula to C14. Assuming that was not just a typo in your post.

Tom

Thanks Tom

Yes that was a typo and it still does not work.

Any suggestions.

Jan

Dates are stored as numbers in Excel, and the comparison is comparing the floating point number to the text string in your comparison.

Look up the DateValue function, which converts a character string date into a floating point number that can be used as a date in formulas and compared to dates stored in cells.

Firstly I am presuming that the first date is actually 31/10/01 and you are sinmply adding 212 days to whatever that date is - ie. 31/10/01 plus 212 = 31/05/02

C14 is a date value and thus not text. In your formula for C16 you are trying to argue that C14 is text, it isn't. You could change your formula in one of 2 ways:

1. If(text(c14,"DD/MM/YY")="31/05/02","31/05/02",1)

2. If(c14=37407,"31/05/02",1)
where 37407 represents the date value of 31/05/02.

I would argue that 1 is easier.

The best way to do what you need is place the Date your look for in a different cell,
as it's not good practice to Hard Code your variables,
you may need to change them later:

use:

=IF(C14=B16,B16,1)

Where B16 contains the date you want.

Replies
6
Views
80
Replies
4
Views
268
Replies
2
Views
217
Replies
2
Views
332
Replies
1
Views
151

1,218,751
Messages
6,144,284
Members
450,535
Latest member
Erlull

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