COUNTIFS with DATEVALUE

Satyen

New Member
Joined
Apr 30, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have a column wherein column A states the name of the airline and column B states the flight departure date. However, column B has some text along with the date. Example:

AirlineETD
UnitedFlight departed on 01-Mar-23
UnitedFlight departed on 02-Mar-23
LufthansaFlight departed on 03-Mar-23
UnitedFlight departed on 23-Mar-23
DeltaFlight departed on 24-Mar-23
UnitedFlight departed on 25-Mar-23
UnitedFlight departed on 01-Apr-23
DeltaFlight departed on 03-Apr-23
LufthansaFlight departed on 05-Apr-23

I would like to count the number of cells wherein the airline is "United" and the departure date is before 01-Apr-23.

How can I use COUNTIFS along with DATEVALUE? or if there is any better way to get the answer?
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Hi, while waiting for other experts, I will share my thought here

Book5
ABCDEFGH
1UnitedFlight departed on 01-Mar-233/1/23United4/1/234
2UnitedFlight departed on 02-Mar-233/2/23
3LufthansaFlight departed on 03-Mar-233/3/23
4UnitedFlight departed on 23-Mar-233/23/23
5DeltaFlight departed on 24-Mar-233/24/23
6UnitedFlight departed on 25-Mar-233/25/23
7UnitedFlight departed on 01-Apr-234/1/23
8DeltaFlight departed on 03-Apr-234/3/23
9LufthansaFlight departed on 05-Apr-234/5/23
Sheet1
Cell Formulas
RangeFormula
H1H1=COUNTIFS(A:A,F1,D:D,"<"&G1)
D1:D9D1=DATEVALUE(SUBSTITUTE(B1,"Flight departed on ",""))


FYI :)
 
Upvote 0
Thanks. Unfortunately, I am not allowed to tamper with the master data by including another column for DATAVALUE. Need one formula that includes COUNTIFS and DATAVALUE.
 
Upvote 0
How about
Fluff.xlsm
ABCDE
1AirlineETD01/04/2023
2UnitedFlight departed on 01-Mar-23United4
3UnitedFlight departed on 02-Mar-23
4LufthansaFlight departed on 03-Mar-23
5UnitedFlight departed on 23-Mar-23
6DeltaFlight departed on 24-Mar-23
7UnitedFlight departed on 25-Mar-23
8UnitedFlight departed on 01-Apr-23
9DeltaFlight departed on 03-Apr-23
10LufthansaFlight departed on 05-Apr-23
Dashboard
Cell Formulas
RangeFormula
E2E2=LET(f,FILTER(--(TEXTAFTER(B2:B20," ",-1)),A2:A20=D2),COUNT(FILTER(f,f<E1)))
 
Upvote 0
How about
Fluff.xlsm
ABCDE
1AirlineETD01/04/2023
2UnitedFlight departed on 01-Mar-23United4
3UnitedFlight departed on 02-Mar-23
4LufthansaFlight departed on 03-Mar-23
5UnitedFlight departed on 23-Mar-23
6DeltaFlight departed on 24-Mar-23
7UnitedFlight departed on 25-Mar-23
8UnitedFlight departed on 01-Apr-23
9DeltaFlight departed on 03-Apr-23
10LufthansaFlight departed on 05-Apr-23
Dashboard
Cell Formulas
RangeFormula
E2E2=LET(f,FILTER(--(TEXTAFTER(B2:B20," ",-1)),A2:A20=D2),COUNT(FILTER(f,f<E1)))

Hi @Fluff , May I know what does -- mean in the formula? Thankyou

As I try to understand the formula and If I delete -- it will become 0.
 
Upvote 0
It's called a double unary and converts a number stored as text into a real number.
 
Upvote 1

Forum statistics

Threads
1,224,820
Messages
6,181,160
Members
453,021
Latest member
Justyna P

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