Counting Only if Conditions are Met

campeao006

New Member
Joined
Nov 23, 2020
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Hi all. I am having some difficulty setting up a proper command to count the difference in time, but only if I have categorized a cell a certain way. For example, below, I would like for the "Time Difference" column to be calculated for just D2 and not D3, as row 3 is classified as a "1". I know the minute difference calculation is =ROUND(ABS((C2-A2)*1440),2), but I don't know how to make this conditional. Ideally, I would like a function that when input into D2, would output as 7 and in D3 would output as nothing (not 0, but nothing).


1610400812333.png
 

Attachments

  • 1610400750417.png
    1610400750417.png
    4.8 KB · Views: 0

Some videos you may like

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

etaf

Well-known Member
Joined
Oct 24, 2012
Messages
4,391
Office Version
  1. 365
Platform
  1. MacOS
before you formula
=ROUND(ABS((C2-A2)*1440),2),

You can add an IF
=IF( C2 <> 1, ROUND(ABS((C2-A2)*1440),2), "")

Why C2-A2 - Should that be B2-A2
 
Solution

campeao006

New Member
Joined
Nov 23, 2020
Messages
4
Office Version
  1. 365
Platform
  1. Windows
before you formula
=ROUND(ABS((C2-A2)*1440),2),

You can add an IF
=IF( C2 <> 1, ROUND(ABS((C2-A2)*1440),2), "")

Why C2-A2 - Should that be B2-A2
Thank you so much, this worked perfectly.

You're right, it should be B2-A2 - I just copied that from my Excel sheet where I have an additional column that I didn't paste in here.
 

etaf

Well-known Member
Joined
Oct 24, 2012
Messages
4,391
Office Version
  1. 365
Platform
  1. MacOS
you are welcome
 

Watch MrExcel Video

Forum statistics

Threads
1,122,364
Messages
5,595,719
Members
414,013
Latest member
tnobbs

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
Top