Counting Only if Conditions are Met

campeao006

New Member
Joined
Nov 23, 2020
Messages
7
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: 1

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
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
 
Upvote 0
Solution
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.
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,394
Members
448,957
Latest member
Hat4Life

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