IF formula with filter getting a singular result

ckdragon

New Member
Joined
Apr 3, 2022
Messages
37
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hi Team,

I am trying to get a IF formula with a Filter function to work.

I have a table that I am referencing and I am trying to get the If formula to show a Yes/No result ONLY if the condition is met at least once.

The formula Is looking for a number that is greater than 2, if the other 2 filter parameters are met.

Sometimes there are multiple filter matches but all of them would = NO, and in which case I just want a single NO to show in the cell not one for each filter match (then all subsequent formulas will calculate as normal in the sheet)

On the chance though that there is even just 1 entry that meets the parameters then I need the result to display YES (so all subsequent formulas stop/other errors show etc)

Therefore, I don't need the result for every filter match, just an overall.

I can't use the text join function because this result feeds into other formulas which operates off the result.

Is there any better way to do this or to fix my below formula??

Hope that makes sense, thank you so much!

=IF(FILTER(Car1_TMR[Distance],(Car1_TMR[To]="Total Distance")*(Car1_TMR[Business Zone Trip]="Journey started and ended in a Business Zone"))>2,"YES","NO")
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Maybe
Excel Formula:
=IF(rows(FILTER(Car1_TMR[Distance],(Car1_TMR[To]="Total Distance")*(Car1_TMR[Business Zone Trip]="Journey started and ended in a Business Zone")))>2,"YES","NO")
 
Upvote 0
Maybe
Excel Formula:
=IF(rows(FILTER(Car1_TMR[Distance],(Car1_TMR[To]="Total Distance")*(Car1_TMR[Business Zone Trip]="Journey started and ended in a Business Zone")))>2,"YES","NO")
Thank you.
Semi-worked...
only showed the FIRST result, not the specific preference result

order of preference
1. Yes - if it is 1 yes or many
2. No - only if there are no yes'

Any any suggestions would be amazing.

Thanks
 
Upvote 0
Try changing the 2 to 0
Okay getting there but, but I think maybe I didn't prove enough detail, because its not working exactly how I need if I change the data set.

essentially the table looks like the below.

NameRego numStartStopFromToDistanceBusiness Zone TripTollsZone startZone end
Car 1Rego17:30:30 AM7:57:26 AMBase StopStop 124.492Base (Business)
Car 1Rego18:13:23 AM9:02:04 AMStop 1Stop 276.323
Car 1Rego19:55:01 AM11:35:06 AMStop 2Base Stop101.266Base (Business)
Car 1Rego111:35:06 AMTotal Distance202.081Tolls
Car 1Rego18:14:12 PM8:15:08 PMBase StopBase Stop0.298Journey started and ended in a Business zoneBase (Business)Base (Business)
Car 1Rego18:15:08 PMTotal Distance0.298Journey started and ended in a Business zoneTolls
Car 1Rego18:22:31 PM9:06:18 PMBase StopBase Stop32.926Journey started and ended in a Business zoneBase (Business)Base (Business)
9:06:18 PMTotal Distance32.926Journey started and ended in a Business zoneTolls


and specifically I want the formula to show "YES" because the last row has a distance of greater than 2 (kms) AND was categorised in a "Business Zone".

But sometimes all the trips are under 2 and sometimes they are over 2.

The original formula I worked until there started being multiple of these kind of trips. essentially anything over 2kms is an issue for me and needs to flag "YES"

Hope that clarifies.

Thanks heaps!
 
Upvote 0
Ok, how about
Excel Formula:
=IF(COUNT(FILTER(ROW(Car1_TMR[Distance]),(Car1_TMR[Distance]>2)*(Car1_TMR[To]="Total Distance")*(Car1_TMR[Business Zone Trip]="Journey started and ended in a Business Zone"))),"YES","NO")
 
Upvote 0
Solution
YOU DEAR SIR ARE AMAZING.

Works like a charm

THANK YOU SO SO VERY MUCH!
Ok, how about
Excel Formula:
=IF(COUNT(FILTER(ROW(Car1_TMR[Distance]),(Car1_TMR[Distance]>2)*(Car1_TMR[To]="Total Distance")*(Car1_TMR[Business Zone Trip]="Journey started and ended in a Business Zone"))),"YES","NO")
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,523
Messages
6,120,030
Members
448,940
Latest member
mdusw

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