Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default IF function query (complex)

I have four columns in a spreadsheet that refer to a CCTV camera fault
reporting log. The first column is the date the fault is initially reported;
the second is the date that the fault is checked; the third is the date that
the fault is fixed - if the fault is yet to be fixed I have inserted a dash
(alternatively I could leave it blank if that is easier). In the fourth
column I'm trying to use the IF function to calculate the number of days
between the date reported and the date checked (first two columns) if the
third column has a dash (or is blank) i.e. not yet fixed; or insert a dash
(or alternative) if there is a date in the third column i.e. it has been
fixed. Complicated, I know. I hope somebody can get their head round it and
work out an answer for me. Thank you.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 180
Default IF function query (complex)

Hi Hammond,

Assuming that you have column heading in first row, enter the below formula
in cell D2 and drag it as long as you have data.

=IF(C2="",B2-A2,C2-A2)
This formula will calculate the diff between col 2 and col 1 if col 3 is
blank. It will find the diff betwn col 3 and col 1 if there is date in col 3.

Also make sure that column D is formatted as General and not Date.
if you want to keep col 4 (column D) as blank then try this

=IF(C2="","",B2-A2)
Hope this helps!!
--
Pranav Vaidya
VBA Developer
PN, MH-India
If you think my answer is useful, please rate this post as an ANSWER!!


"Hammond-Wandsworth" wrote:

I have four columns in a spreadsheet that refer to a CCTV camera fault
reporting log. The first column is the date the fault is initially reported;
the second is the date that the fault is checked; the third is the date that
the fault is fixed - if the fault is yet to be fixed I have inserted a dash
(alternatively I could leave it blank if that is easier). In the fourth
column I'm trying to use the IF function to calculate the number of days
between the date reported and the date checked (first two columns) if the
third column has a dash (or is blank) i.e. not yet fixed; or insert a dash
(or alternative) if there is a date in the third column i.e. it has been
fixed. Complicated, I know. I hope somebody can get their head round it and
work out an answer for me. Thank you.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default IF function query (complex)

Hi,

I lost the logic a bit so 2 formula to try in D1 and drag down:-
=IF(C1="",B1-A1,C1-A1)
This one works out the days between a1 & b1 if c1 is blank or b1 and c1 if
c1 has a date.

=IF(C1="",B1-A1,"-")
Similar but put a dash in D is c has a date

Mike
"Hammond-Wandsworth" wrote:

I have four columns in a spreadsheet that refer to a CCTV camera fault
reporting log. The first column is the date the fault is initially reported;
the second is the date that the fault is checked; the third is the date that
the fault is fixed - if the fault is yet to be fixed I have inserted a dash
(alternatively I could leave it blank if that is easier). In the fourth
column I'm trying to use the IF function to calculate the number of days
between the date reported and the date checked (first two columns) if the
third column has a dash (or is blank) i.e. not yet fixed; or insert a dash
(or alternative) if there is a date in the third column i.e. it has been
fixed. Complicated, I know. I hope somebody can get their head round it and
work out an answer for me. Thank you.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default IF function query (complex)

Thank you guys, both extremely helpful. Thanks also from the colleagues who
tasked me with this brain stretcher!

"Pranav Vaidya" wrote:

Hi Hammond,

Assuming that you have column heading in first row, enter the below formula
in cell D2 and drag it as long as you have data.

=IF(C2="",B2-A2,C2-A2)
This formula will calculate the diff between col 2 and col 1 if col 3 is
blank. It will find the diff betwn col 3 and col 1 if there is date in col 3.

Also make sure that column D is formatted as General and not Date.
if you want to keep col 4 (column D) as blank then try this

=IF(C2="","",B2-A2)
Hope this helps!!
--
Pranav Vaidya
VBA Developer
PN, MH-India
If you think my answer is useful, please rate this post as an ANSWER!!


"Hammond-Wandsworth" wrote:

I have four columns in a spreadsheet that refer to a CCTV camera fault
reporting log. The first column is the date the fault is initially reported;
the second is the date that the fault is checked; the third is the date that
the fault is fixed - if the fault is yet to be fixed I have inserted a dash
(alternatively I could leave it blank if that is easier). In the fourth
column I'm trying to use the IF function to calculate the number of days
between the date reported and the date checked (first two columns) if the
third column has a dash (or is blank) i.e. not yet fixed; or insert a dash
(or alternative) if there is a date in the third column i.e. it has been
fixed. Complicated, I know. I hope somebody can get their head round it and
work out an answer for me. Thank you.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Complex Function? Metolius Dad Excel Worksheet Functions 2 August 31st 06 06:04 AM
complex function GTUGoddess Excel Worksheet Functions 4 September 20th 05 02:55 PM
Complex query question Stacy Excel Worksheet Functions 0 June 30th 05 09:50 PM
Complex if and mid function. brookdale Excel Worksheet Functions 5 June 28th 05 07:52 PM
Microsoft Query rejects "nz" function in Access Query Vaughan Excel Discussion (Misc queries) 0 May 4th 05 05:20 PM


All times are GMT +1. The time now is 10:45 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"