Formula that add a number if a value is greater or equal ...

silvy

New member
Joined
Dec 12, 2018
Messages
2
Reaction score
0
Points
0
Excel Version(s)
2016
What formula to use for the following question?
Insert a formula in column G that adds 45 days to the date in column B for trade ins 2009 and older and adds 60 days to tradeins 2010 and newer.
Thanks
 

Attachments

  • EL1-C2-CS-AASFebTradeIns.xlsx
    14.2 KB · Views: 9
.
Is this homework ? Presuming it is ...

The formula you are seeking starts with an IF statement : =IF

Then you will be testing the date in Col F to determine if it is less than the year 2010.

If it is, you will be adding 45 days to the date in Col B.

If it is not, you will be adding 60 days to the date in Col B.


Do an internet search for using the IF statement in an Excel formula. And for detecting if the date is "greater than >" or "less than <".

Also search for adding days to an existing date.
 
@silvy
It's not enough to say just "thanks". You have to take some effort to do something.
If it is a homework, I will try help you with this example but you need learn Excel.
So you have two conditions

  1. <=2009
  2. >2009

If the first condition is met you add 45 days, to Date from the 'B' column
If the first condition is not met you add 60 days to Date from 'B' column

As @Logit said it is necessary to use the Excel IF function.
Why?
Because this Excel function is basically based on one condition (or two conditions). In fact, it is based on TRUE or FALSE.

The formula would be the following:
Code:
=IF(F4<=2009;B4+45;B4+60)

The Syntax IF function has the following arguments
Code:
=IF(logical_test;value_if_true;value_if_false)

or
=IF(1st_argument;2nd_argument;3rd_argument)

or
=IF(condition;ResultIfConditionMet;ResultIfConditionNotMet)

The first argument, the IF function is 'logical_test'. For the first argument you set the first condition ie 'F4 <= 2009', because in the 'F' column are the years that are your condition.
In this case, you have 2001 in F4. So the first condition is met.

The second argument, the IF function is 'value_if_true'.
So, if the condition from the first argument, in the 'F' column is satisfied, then the IF function should return the result from the second argument.
In the translated sense, this means that if the condition from the first argument is met, the result should be Date in B4 + 45 days. So, 01.02.2015 + 45 days

If the condition from the first argument is not satisfied,then the IF function should return the result from the third argument ie your other condition or Date to B4 + 60 days'.
The third argument, the IF function is 'value_if_false'. Instead of this argument I put "B4 + 60". So if the year in 'F4' cell is higher than 2009 then IF function as the final result will return the third argument IF function.

Always put the formula in the first Row/Cell and copy as necessary down or right. Keep in mind the absolute and relative addresses in the formula, because they often depend on the result of copying the formula.

I hope I have somehow managed to explain to you how the IF function works. So learn the basics of Excel and study Excel functions.
Good luck learning Excel.
Sorry for my bad english.
 

Attachments

  • silvy-navic9663.xlsx
    15 KB · Views: 7
I figured out my self, but my formula it's much longer and seems complicated, but I got the same answers as yours so it's mean I did it right anyway.
Thank you for your explanation anyway.
 

Attachments

  • EL1-C2-CS-AASFebTradeIns.xlsx
    15 KB · Views: 7
That is a good start and will work
But yes, you can shorten it.
Think of it like this : if you first condition is not satisfied, the only possibility (in this case) is the second condition which boils down to FALSE as navic explained.
I'll let you think about that if you have some time left. Don't forget XL as an Evaluate formula feature which can be very helpful
 
my formula it's much longer and seems complicated, but I got the same answers as yours
Hi
Or, I did not understand you well or you did not understand my explanation.
This your formula is wrong (that is my opinion). See how to use the Evaluate formula and the 'F9' key.

What is the condition in your example?
1 - Year from 'B' column
2 - Year from 'F' column

Look again attached example. (You notice that you set years in 'F' column as text).

My correct results are not the same as yours.
If the condition of the year in the 'B' column then the formula is next.
Code:
=IF(YEAR(B4)<=2009;B4+45;B4+60)
You notice that I'm in the formula above, nestled function YEAR().
 

Attachments

  • silvy-navic9663-2.xlsx
    21.5 KB · Views: 6
Back
Top