Formula for Date

AndrewTrevayne

New Member
Joined
Jul 27, 2013
Messages
8
Hi all,
Can you help me with a formula on date?
Basically, I want to add Years on the date based on a criteria.

Logic is:
If date in columnA is paired with X in ColumnB add 1 year to ColumnC
If date in columnA is paired with Z in ColumnB add 2 years to ColumnC
If date in columnA is paired with Y in ColumnB add 3 years to ColumnC


1660095995032.png


Thanks in advance.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
2 alternatives

T202208a.xlsm
ABCDEF
1
210-Aug-22X10-Aug-2310-Aug-23X12
3Y36
4Z24
5
3a
Cell Formulas
RangeFormula
C2C2=EDATE(A2,LOOKUP(B2,E2:F4))
D2D2=EDATE(A2,IF(B2="X",12,IF(B2="Y",36,IF(B2="Z",24,0))))
 
Upvote 0
Book2
ABC
110/08/2022X10/08/2023
210/08/2022Y10/08/2024
310/08/2022Z
Sheet3
Cell Formulas
RangeFormula
C1C1=EDATE(A1,LOOKUP(B1,{"X","Y","Z"},{12,24,36}))
C2C2=IFS(B2="X",EDATE(A2,12),B2="Y",EDATE(A2,24),B2="Z",EDATE(A2,36))
 
Upvote 0
Solution
thought @Phuoc 's solution in post #3 was the best... I agree

@Phuoc 's solution is logical but the specifications did say


Logic is:
If date in columnA is paired with X in ColumnB add 1 year to ColumnC
If date in columnA is paired with Z in ColumnB add 2 years to ColumnC
If date in columnA is paired with Y in ColumnB add 3 years to ColumnC
 
Upvote 0

Forum statistics

Threads
1,214,650
Messages
6,120,736
Members
448,988
Latest member
BB_Unlv

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