If/Then formula using text and dates

Danandem

New Member
Joined
May 6, 2009
Messages
7
I have three cells I want to use, for this purpose I'll go with A1, B1, and C1. If A1 has the word (SECRET), then I want C1 to add ten years to the date in B1 and if the word in A1 says TOP SECRET, then I want C1 to add five years to the date in B1. If there is nothing in A1, then I want C1 to be red in color.
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Hi and welcome to the board!!
Code:
=IF(A1="Search",DATE(YEAR(B1)+10,MONTH(B1),DAY(B1)),IF(B1<>"",DATE(YEAR(B1)+5,MONTH(B1),DAY(AB1)),""))
Use Conditional formatting to color C1 Red when A1 = ""
lenze
 
Upvote 0
Still not working. Can you put the words SECRET and TOP SECRET in the appropriate spots to show me how it reads. Using your formula, I replaced the word serach with Top Secret and put the word Secret where I thought it should go. Don't know if you putting B1 (I put it in bold) instead of A1 was a mistake or not. I included your formula (top) and how I put the data in (bottom). Any help would be greatly appreciated. Thank you!

=IF(A1="Search",DATE(YEAR(B1)+10,MONTH(B1),DAY(B1)),IF(B1<>"",DATE(YEAR(B1)+5,MONTH(B1),DAY(AB1)),""))


=IF(A1="Top Secret",DATE(YEAR(B1)+10,MONTH(B1),DAY(B1)),IF(A1="Secret",DATE(YEAR(B1)+5,MONTH(B1),DAY(AB1)),""))
 
Upvote 0
The B1 was a typo. Should have been A1. So was "Search". I assumed Secret and Top Secret where the only choices were "Secret" and "Top "Secret". You can use
Code:
=IF(A1="Secret",DATE(YEAR(B1)+10,MONTH(B1),DAY(B1)),IF(A1="Top Secret",DATE(YEAR(B1)+5,MONTH(B1),DAY(B1)),""))
lenze
 
Upvote 0
Awesome. Thank you very much!!!!!!!!!!!!:biggrin:

Follow on question, if you don't mind? I have two excel spreadsheets, one is my tracking/working sheet and the other is a higher headquarters. I want the data in my sheet to automatically update the other sheet without having to set the formula line by line or copy/paste the entire section. I have over 800 people I track! The higher headquarters has the different units on seperate tabs/sheets.
 
Upvote 0

Forum statistics

Threads
1,215,046
Messages
6,122,852
Members
449,096
Latest member
Erald

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