Grab cell data and use in "IF" statement

0

Is it possible to grab a cell containing a date and paste that date in an "IF" statement containing text, similar to the below:

=IF(OR(I1=TRUE,J1=TRUE),"Date:___________________",IF(AND(I1=FALSE,J1=FALSE),"Date:________N/A_________"))

I have tried:

=IF(OR(I1=TRUE,J1=TRUE),"Date:Sheet1!D2",IF(AND(I1=FALSE,J1=FALSE),"Date:________N/A_________"))

and also

=IF(OR(I1=TRUE,J1=TRUE),"Date:=TODAY()",IF(AND(I1=FALSE,J1=FALSE),"Date:________N/A_________"))

But those display Sheet1!D2 and =TODAY() respectively instead of the actual date in the cell.

David

Posted 2015-04-14T20:15:37.187

Reputation: 87

Answers

0

You need to use the CONCATENATE function to concatenate Date: and the value, like so:

=IF(OR(I1=TRUE,J1=TRUE),CONCATENATE("Date:",Sheet1!D2),IF(AND(I1=FALSE,J1=FALSE),"Date:________N/A_________"))

imtheman

Posted 2015-04-14T20:15:37.187

Reputation: 3 503

Thanks, looks like it will do what I want with some fine tuning as it is currently giving me some random value, not the actual date, but atleast something is happening.I will ask for assistance again if I get lost. Thanks again – David – 2015-04-14T20:33:41.000

Great! Glad I could push you in the right direction. – imtheman – 2015-04-14T20:34:26.383

1You can also concatenate with an ampersand instead of the function: "Date:"&Sheet1!D2. – fixer1234 – 2015-04-14T20:35:05.337

@fixer1234 Thanks! I did not know that. – imtheman – 2015-04-14T20:35:47.580

@David: that "random" value is likely the "raw" stored date. You may need to format the result as a date. – fixer1234 – 2015-04-14T20:36:26.720

@fixer1234, thanks. Will check it – David – 2015-04-14T20:39:40.810

@fixer1234, yep, you are right about the formatting. Had to set it to "text". Thanks alot – David – 2015-04-14T20:46:00.727

@David: With the date buried inside a text string, formatting the cell might be a problem for an embedded date. If so, you could do it with the TEXT function. It would look something like: TEXT(Sheet1!D2,"dd/mm/yyy") in place of the cell reference.

– fixer1234 – 2015-04-14T20:50:58.553

@fixer1234, alright. Got it working with the TEXT function. Much appreciated – David – 2015-04-14T21:10:46.717

@imtheman: just noticed, this pushed you over 2K. Congrats. – fixer1234 – 2015-04-14T21:14:07.937

@fixer1234 Thanks! I've been working towards that for some time now. :) – imtheman – 2015-04-14T21:15:11.153