Trying to combine If statements

dezibluenose

New Member
Joined
Oct 6, 2021
Messages
9
Office Version
  1. 365
Platform
  1. Windows
Hi All - again I'm showing my lack of excel skills here and hoping someone can help me out.

I'm trying to complete a report for my work and show the days between an audit start and close date - easy enough to do and in column C of the picture below I put the following:-

=IF(B2="","",(DAYS(B2,A2))) As you can see, it give me what I need - shows the days between the start and end of the audit, and if the audit is not closed it shows as blank.


Where my problems start is when I've asked to do the same thing for audits that have not been closed yet. My formula works fine until it comes across an audit that's not been started yet.

I tried this formula =IF(B2="",TODAY()-A2,C2) - saying if the audit is not closed, show me the days it's been open for, and if it is closed, refer to the answer in the previous formula. Again that works fine unless the audit is not started yet and it's blank for audit start date. When that happens I get a massive wrong number.

I was trying to combine an IF and an OR statement together but started getting all sorts of wrong numbers. This will probably be something simple but how would you fix it so that if an audit hasn't been started yet I just see a blank entry, but retain the formula showing the open number of days?

Example Sheet
1710862686842.png


Formulas Used
1710862918692.png
 

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.
so if the audit has not started then

=IF( A2 = "", "", IF(
now we need to add the other formula
IF(B2="",TODAY()-A2,C2
and if A2 and B2 has a date
(DAYS(B2,A2)))

so
=IF( A2 = "", "", IF(B2="",TODAY()-A2,DAYS(B2,A2) ))
or
=IF( A2 = "", "", IF(B2="",TODAY()-A2,B2-A2 ))

Book5
ABC
1stratenddays
2 
31/1/241/2/241
41/1/2478
5 
Sheet1
Cell Formulas
RangeFormula
C2:C4C2=IF( A2 = "", "", IF(B2="",TODAY()-A2,B2-A2 ))
C5C5=IF( A5 = "", "", IF(B5="",TODAY()-A5,DAYS(B5,A5) ))
 
Upvote 1
Solution
so if the audit has not started then

=IF( A2 = "", "", IF(
now we need to add the other formula
IF(B2="",TODAY()-A2,C2
and if A2 and B2 has a date
(DAYS(B2,A2)))

so
=IF( A2 = "", "", IF(B2="",TODAY()-A2,DAYS(B2,A2) ))
or
=IF( A2 = "", "", IF(B2="",TODAY()-A2,B2-A2 ))

Book5
ABC
1stratenddays
2 
31/1/241/2/241
41/1/2478
5 
Sheet1
Cell Formulas
RangeFormula
C2:C4C2=IF( A2 = "", "", IF(B2="",TODAY()-A2,B2-A2 ))
C5C5=IF( A5 = "", "", IF(B5="",TODAY()-A5,DAYS(B5,A5) ))
Fantastic etaf - thank you so much. That works perfectly.

Now as usual I need to break down everything you did for the future. Thanks again.
 
Upvote 0
you are welcome

Nested IF
IF( test, result if true , result if false )
so you can replace the true or the false with another if statement

IF( test, result if true , IF( test, result if true , IF( test, result if true , result if false ) ) )
it works in left to right Order
maybe that helps a little
otherwise - look for info on NESTED IF
 
Upvote 1

Forum statistics

Threads
1,215,069
Messages
6,122,959
Members
449,096
Latest member
Anshu121

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