IF Function

LJS7

New Member
Joined
Mar 30, 2011
Messages
7
I am using an the IF Function to return £6.00:
like this:
IF(G25="0YEARS 0MONTHS 0DAY/S","£6.00")
but excel dosen't seem to like the numbers and letters together any help is much appreciated.
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
There's nothing wrong with what you're checking -- letters, numbers, anything can be inside the if-statement:
=IF(G25="anything here","Anything here too","And here as well")
 
Upvote 0
I just doesn't work i can't understand why, all i can say is cell G25's content is from a DATEIF formula
 
Upvote 0
What is the value that is returned in G25? That will largely determine how the IF statement needs to be written.
 
Upvote 0
Try:

=IF(G27="","£6.00")

if this doesn't work, please try providing more details as well as your input and desired output.
 
Upvote 0
Here we go in a bit more detail i would like you to try this oon your own PC:

Formula for cell G25 is:

=DATEDIF(E25,F25,"Y")&" YEARS "&DATEDIF(E25,F25,"ym")&" MONTHS "&DATEDIF(E25,F25,"md")&" DAY/S "

Enter: 01/02/2010 into cells E25 and F25

and

try this formula in cell H25:

=IF(G25="0 YEARS 0MONTHS 1DAY/S","£6.00")

it just dosen't return £6.00 in cell H25
 
Upvote 0
Your DateDif formula has an extra space after the DAY/S part that wasn't being accounted for. Try either:

<b>Excel 2003</b><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #A6AAB6"><colgroup><col width="25px" style="background-color: #E0E0F0" /><col /><col /><col /><col /></colgroup><thead><tr style=" background-color: #E0E0F0;text-align: center;color: #161120"><th></th><th>E</th><th>F</th><th>G</th><th>H</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">25</td><td style="text-align: right;;">1/2/2010</td><td style="text-align: right;;">1/2/2010</td><td style=";">0 YEARS 0 MONTHS 0 DAY/S </td><td style=";">£6.00</td></tr></tbody></table><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #A6AAB6"><thead><tr style="background-color: #E0E0F0;text-align: center;color: #161120"><th><b>Sheet1</b></th></tr></td></thead></table><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: #FFFFFF" ><tr><td style="padding:6px" ><b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: #FFFFFF;border-collapse: collapse; border-color: #A6AAB6"><thead><tr style=" background-color: #E0E0F0;color: #161120"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: #E0E0F0;color: #161120">G25</th><td style="text-align:left">=DATEDIF(<font color="Blue">E25,F25,"Y"</font>)&" YEARS "&DATEDIF(<font color="Blue">E25,F25,"ym"</font>)&" MONTHS "&DATEDIF(<font color="Blue">E25,F25,"md"</font>)&" DAY/S "</td></tr><tr><th width="10px" style=" background-color: #E0E0F0;color: #161120">H25</th><td style="text-align:left">=IF(<font color="Blue">G25="0 YEARS 0 MONTHS 0 DAY/S ","£6.00"</font>)</td></tr></tbody></table></td></tr></table><br />

or

<b>Excel 2003</b><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #A6AAB6"><colgroup><col width="25px" style="background-color: #E0E0F0" /><col /><col /><col /><col /></colgroup><thead><tr style=" background-color: #E0E0F0;text-align: center;color: #161120"><th></th><th>E</th><th>F</th><th>G</th><th>H</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">25</td><td style="text-align: right;;">1/2/2010</td><td style="text-align: right;;">1/2/2010</td><td style=";">0 YEARS 0 MONTHS 0 DAY/S</td><td style=";">£6.00</td></tr></tbody></table><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #A6AAB6"><thead><tr style="background-color: #E0E0F0;text-align: center;color: #161120"><th><b>Sheet1</b></th></tr></td></thead></table><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: #FFFFFF" ><tr><td style="padding:6px" ><b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: #FFFFFF;border-collapse: collapse; border-color: #A6AAB6"><thead><tr style=" background-color: #E0E0F0;color: #161120"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: #E0E0F0;color: #161120">G25</th><td style="text-align:left">=DATEDIF(<font color="Blue">E25,F25,"Y"</font>)&" YEARS "&DATEDIF(<font color="Blue">E25,F25,"ym"</font>)&" MONTHS "&DATEDIF(<font color="Blue">E25,F25,"md"</font>)&" DAY/S"</td></tr><tr><th width="10px" style=" background-color: #E0E0F0;color: #161120">H25</th><td style="text-align:left">=IF(<font color="Blue">G25="0 YEARS 0 MONTHS 0 DAY/S","£6.00"</font>)</td></tr></tbody></table></td></tr></table><br />
 
Upvote 0
Thanks mate works perfectly i knew the formula wasn't wrong but i just couldn't see that mistake thank-you again.

I will probabely need you again in the coming weeks as i am building a spreadsheet for a freind.
 
Upvote 0

Forum statistics

Threads
1,224,503
Messages
6,179,134
Members
452,890
Latest member
Nikhil Ramesh

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