Allocating a value based on multiple criteria

chrisou

New Member
Joined
Sep 18, 2022
Messages
5
Office Version
  1. 2013
Platform
  1. Windows
HI Guys

I have attached a simplified excel file containing 2 worksheets (Alarm data and Summary).
I would like a value of 1 put in column D of the "Alarm data worksheet" for all the alarms which correspond to the date and start and finish time intervals in the "summary worksheet" . I have put in column E the answer I am looking for the formula to generate

Many thanks for your help

Chris
 

Attachments

  • Alarm data.jpg
    Alarm data.jpg
    86.2 KB · Views: 15
  • summary.jpg
    summary.jpg
    35.7 KB · Views: 14

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.
You can use COUNTIFS for this, where you're counting the number of SUMMARY tab rows that match on date, have a start time on or before the alarm time, and have an end time on or after the alarm time.

D2 =--(COUNTIFS(Summary!A:A,A2,Summary!B:B,"<="&B2,Summary!C:C,">="&B2)>0) copied down
 
Upvote 0
HI Oaktree
Thanks for your help. The formula works except for the first occurance which gives a false return. Otherwise the other returns which satisfy the criteria provide a true reply. I don't know why the first occurance gives a false reply despite matching the criteria...?
Chris
 
Upvote 0
Are you saying cell D5 is giving a 0 instead of a 1?

Is its formula D5 =--(COUNTIFS(Summary!A:A,A5,Summary!B:B,"<="&B5,Summary!C:C,">="&B5)>0) ?
 
Upvote 0
Solution
Are you saying cell D5 is giving a 0 instead of a 1?

Is its formula D5 =--(COUNTIFS(Summary!A:A,A5,Summary!B:B,"<="&B5,Summary!C:C,">="&B5)>0) ?
Hi Oaktree
My error... I copied the formula into D3 instead of D2. Your formula works perfectly.
Many thanks
Chris
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,702
Members
448,980
Latest member
CarlosWin

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