If Then function shows number despite empty cell?

Good day,

I can't figure out the error. Here's what's going on: it's about calculating anniversary years.

I want to know when someone has an anniversary—here, 1, 2, 5, and 10 years. This works perfectly. But if the first day isn't maintained, it displays 124.

P4 is a date

Year = 2024

=IF(REST(YEAR(P4)-$R$1;1)=0;$R$1-YEAR(P4);"-")

If P4 is empty, I see 124. Why? I don't want anything to be displayed if P4 isn't maintained.

Greetings Christin

2 votes, average: 2.00 out of 1 (2 rating, 2 votes, rated)
You need to be a registered member to rate this.
Loading...
Subscribe
Notify of
4 Answers
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
DonCredo
1 year ago

Hi! Without entering into your calculations now: just ask P4 at the beginning of the If chain, try out what's going on:

=if(isempty(p4)) ";if(your formula) and another clampzu.

This first when queries the content of P4 and if there's nothing in there comes a blank. If it couldn't work, you could spend a 0 instead. When empty, your formula will not be started. I have often built this into countless tables.

Greeting

DonCredo
1 year ago
Reply to  Cassiopaiae

Please, please.

GutenTag2003
1 year ago

What kind of rest should come out?

Only one negative result can result from R1 (if zero) P4 in deduction.