Hello everybody,
In my userform I have textboxes containing dates and others containing times.
I need to find a way to subtract times considering that:
textbox_EDA = Estimated date of arrival
textbox_ETA = Estimated time of arrival
textbox_ADA = Actual date of arrival
textbox_ATA = Actual time of arrival
textbox_EDD = Estimated date of departure
textbox_ETD = Estimated time of departure
textbox_ADD = Actual departure date
textbox_ATD = Actual time of departure
(The reason why I have the dates and not only the times is because flights can arrive one day and depart the say after)
ATA - ETA (gives the arrival delay, if any)
ETD - ATD (gives the departure delay, if any)
ATD - ATA (gives the actual ground time)
of course all the times given must keep in consideration also the dates...
Attached please find a test sheet where in cells X2:AA2 I have the formulas I would like to have in vba
Thanks in advance for any help
In my userform I have textboxes containing dates and others containing times.
I need to find a way to subtract times considering that:
textbox_EDA = Estimated date of arrival
textbox_ETA = Estimated time of arrival
textbox_ADA = Actual date of arrival
textbox_ATA = Actual time of arrival
textbox_EDD = Estimated date of departure
textbox_ETD = Estimated time of departure
textbox_ADD = Actual departure date
textbox_ATD = Actual time of departure
(The reason why I have the dates and not only the times is because flights can arrive one day and depart the say after)
ATA - ETA (gives the arrival delay, if any)
ETD - ATD (gives the departure delay, if any)
ATD - ATA (gives the actual ground time)
of course all the times given must keep in consideration also the dates...
Attached please find a test sheet where in cells X2:AA2 I have the formulas I would like to have in vba
Test.xlsm | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | AA | AB | AC | AD | AE | AF | |||
1 | ARRIVAL ETA | ARRIVAL ATA | DEPARTURE ETD | DEPARTURE ATD | Mail Net Weight | DELAY IN | TOT DELAY | Ground Time | AGT | REM | ||||||||||||
2 | 03/05/22 | 09:00 | 3-May | 10:30 | 04/05/22 | 08:30 | 04/05/22 | 09:15 | 0 | 01:30 | 00:45 | -00:30 | 22:45 | 0:45 | ||||||||
3 | ||||||||||||||||||||||
4 | ||||||||||||||||||||||
Flight Details |
Cell Formulas | ||
---|---|---|
Range | Formula | |
V2 | V2 | =E2-F2 |
X2 | X2 | =TEXT(P2-N2,"hh:mm") |
Y2 | Y2 | =TEXT(T2-R2,"hh:mm") |
Z2 | Z2 | =TEXT(R2-N2,"hh:mm") |
AA2 | AA2 | =IF(P2>T2,T2+(1-P2),T2-P2) |
AE2 | AE2 | =Y2-AB2-AC2-AD2 |
Thanks in advance for any help