Unable to put if function

toony

Board Regular
Joined
Mar 20, 2014
Messages
91
Office Version
  1. 365
Hi. Hope that you can help with what surely is an easy question.
Tryin to just do a simple if funtion as below but excel advises to do =IF(V3="","") * (Z3-D3) instead and doesn't accept the below.
What am I doing wrong? Thank you for your time in advance

=IF(V3="",""),(Z3-D3)
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Is this what you want?
VBA Code:
=IF(V3="","",(Z3-D3))
 
Upvote 0
Hey many thanks for the quick reply. Makes all the sense and it works perfect.
 
Upvote 0
You are welcome.
Yes, once you put that first right parend in there, you are closing out the IF statement, so the stuff after it is never considered.
 
Upvote 0
Only problem I hve now is that the result in AA3 is not quite correct as you can see in the attached. It gives me 0.04 when in reality is 1 hour.
 
Upvote 0
I do not see anything attached. You can post images, but you cannot attach files.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.

Without knowing what your values are and what you want to return, it is hard for us to determine what the issue is.
Note that when subtracting dates or times, it is important to understand how Excel actually stores dates and times.
It actually stores them as the number of days since 1/0/1900, and time is just the fraction of a day.
So dates and times are just numbers in Excel with date/time formatting applied.
You will probably need to apply a format to your result cell to see it presented the way you want.
 
Upvote 0
Sorry but I don't think that the previous attachment worked so I have re-attahed it wit correct format. As mentioned, the column AA doesn't give correct results.
AA3 should give 60min but gives 0.04. I think that it's because I've mixed dates and time but not sure.
i've used formula; =IF(V3="","",(Z3-D3))
 

Attachments

  • AA3.....jpg
    AA3.....jpg
    57.8 KB · Views: 3
Upvote 0
Sorry but I don't think that the previous attachment worked so I have re-attahed it wit correct format. As mentioned, the column AA doesn't give correct results.
AA3 should give 60min but gives 0.04. I think that it's because I've mixed dates and time but not sure.
i've used formula; =IF(V3="","",(Z3-D3))
OK, it is exactly as I described above:
Note that when subtracting dates or times, it is important to understand how Excel actually stores dates and times.
It actually stores them as the number of days since 1/0/1900, and time is just the fraction of a day.
So dates and times are just numbers in Excel with date/time formatting applied.
You will probably need to apply a format to your result cell to see it presented the way you want.
So it actually is returning the right answer, it is just not formatted the wat you are used to.
Just change the format of the cell to:
Excel Formula:
h:mm
and it will look like what you expect.
 
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