excel syntax problem for formula... difference in days

jorpe

New member
Power User
VIP
Local time
4:17 AM
Messages
278
Location
mile high
if I have 2 columns of dates and I want to find the number of days between the days of D2 and C2, what is the syntax for the formula so that the result in column E is x number of days between the two dates
 

My Computer

OS
7600x64 ultimate, not SP1
CPU
i7 930
Motherboard
Gigabye X58A-ud5
Memory
12gb ddr3 1600 triple channel Corsair XMS3
Graphics Card(s)
Radeon 5850 1gb OC edition
Sound Card
Asus Xonar Essence STX
Monitor(s) Displays
Acer 24'', Dell 23'' display port
Screen Resolution
1920x1200, 1920x1080
Hard Drives
3x64GB Microcenter SSDs RAID0
1tb spinpoint f3 (system)
1tb spinpoint f3 (media)
1tb spinpoint f3 OSX
1x2TB WD green images
1tb 7200.12 (time machine)
2x 500gb western digital green drives for archiving,keeping install files.
PSU
700 modular
Case
Antec 1200
Cooling
Promlimatech Megahalems
Keyboard
logitech 2.4ghz wireless wave something
Mouse
logitech laser wireless mouse.
Internet Speed
50/10
Other Info
4 systems currently:
1. sig rig
2. 930 i7 x64 ultimate (backup, media center PC)
3. c314 2gb ram tablet 7600 ultimate
4. athlon 6000+ home server (still in progress)
5. ipad for on the go
Format the columns as follows:

Columns C and D as Date (you choose the specific date format).
Column E as Number (with 0 Decimal places).

The formula to use in Column E to give the difference in days is as follows (assuming that C is an earlier date than D):

E=D-C (E2=D2-C2)

If you want the number of days between, but not counting either day, then the formula is:

E=D-C-1 (E2=D2-C2-1)

If, on the other hand, you want to know the inclusive number of days, the formula is:

E=D-C+1 (E2=D2-C2+1)

Note that the above may yield negative results. To avoid that, use these modified formulae instead:

E=ABS(D-C) (E2=ABS(D2-C2))
E=ABS(D-C)-1 (E2=ABS(D2-C2)-1)
E=ABS(D-C)+1 (E2=ABS(D2-C2)+1)
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Dwarf Dwf/11/2012 r09/2013
OS
Windows 8.1 Pro RTM x64
CPU
Intel Core-i5-3570K 4-core @ 3.4GHz (Ivy Bridge) (OC 4.4GHz)
Motherboard
ASRock Z77 Extreme4-M
Memory
4 x 4GB DDR3-1600 Corsair Vengeance CMZ8GX3M2A1600C9B (16GB)
Graphics Card(s)
MSI GeForce GTX770 Gaming OC 2GB
Sound Card
Realtek High Definition on board solution (ALC 898)
Monitor(s) Displays
ViewSonic VA1912w Widescreen (VGA)
Screen Resolution
1440x900
Hard Drives
OCZ Agility 3 SSD 120GB SATA III x2 (RAID 0)
Samsung HD501LJ 500GB SATA II x2
Hitachi HDS721010CLA332 1TB SATA II
Iomega 1.5TB Ext USB 2.0
WD 2.0TB Ext USB 3.0
PSU
XFX Pro Series 850W Semi-Modular
Case
Gigabyte IF233
Cooling
1 x 120mm Front Inlet 1 x 120mm Rear Exhaust
Keyboard
Microsoft Comfort Curve Keyboard 3000 (USB)
Mouse
Microsoft Comfort Mouse 3000 for Business (USB)
Internet Speed
NetGear DG834Gv3 ADSL Modem/Router (Ethernet) ~4.0 Mb/s (O2)
Antivirus
Avast! 8.0.1497
Browser
IE 11
Other Info
Optical Drive: HL-DT-ST BD-RE BH10LS30 SATA Bluray
Lexmark S305 Printer/Scanner/Copier (USB)
WEI Score: 8.1/8.1/8.5/8.5/8.25
Asus Eee PC 1011PX Netbook (Windows 7 x86 Starter)
Thank you, I didn't realize I could subtract dates like that.
 

My Computer

OS
7600x64 ultimate, not SP1
CPU
i7 930
Motherboard
Gigabye X58A-ud5
Memory
12gb ddr3 1600 triple channel Corsair XMS3
Graphics Card(s)
Radeon 5850 1gb OC edition
Sound Card
Asus Xonar Essence STX
Monitor(s) Displays
Acer 24'', Dell 23'' display port
Screen Resolution
1920x1200, 1920x1080
Hard Drives
3x64GB Microcenter SSDs RAID0
1tb spinpoint f3 (system)
1tb spinpoint f3 (media)
1tb spinpoint f3 OSX
1x2TB WD green images
1tb 7200.12 (time machine)
2x 500gb western digital green drives for archiving,keeping install files.
PSU
700 modular
Case
Antec 1200
Cooling
Promlimatech Megahalems
Keyboard
logitech 2.4ghz wireless wave something
Mouse
logitech laser wireless mouse.
Internet Speed
50/10
Other Info
4 systems currently:
1. sig rig
2. 930 i7 x64 ultimate (backup, media center PC)
3. c314 2gb ram tablet 7600 ultimate
4. athlon 6000+ home server (still in progress)
5. ipad for on the go
You're welcome. Incidentally, if the dates happen to be the same (which is unlikely, but cannot be totally ruled out), then the following minor alteration to the relative formulae will take care of it (and are the versions that I recommend).

E2=IF((D2==C2),0,ABS(D2-C2))
E2=IF((D2==C2),0,ABS(D2-C2)-1)
E2=IF((D2==C2),0,ABS(D2-C2)+1)
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Dwarf Dwf/11/2012 r09/2013
OS
Windows 8.1 Pro RTM x64
CPU
Intel Core-i5-3570K 4-core @ 3.4GHz (Ivy Bridge) (OC 4.4GHz)
Motherboard
ASRock Z77 Extreme4-M
Memory
4 x 4GB DDR3-1600 Corsair Vengeance CMZ8GX3M2A1600C9B (16GB)
Graphics Card(s)
MSI GeForce GTX770 Gaming OC 2GB
Sound Card
Realtek High Definition on board solution (ALC 898)
Monitor(s) Displays
ViewSonic VA1912w Widescreen (VGA)
Screen Resolution
1440x900
Hard Drives
OCZ Agility 3 SSD 120GB SATA III x2 (RAID 0)
Samsung HD501LJ 500GB SATA II x2
Hitachi HDS721010CLA332 1TB SATA II
Iomega 1.5TB Ext USB 2.0
WD 2.0TB Ext USB 3.0
PSU
XFX Pro Series 850W Semi-Modular
Case
Gigabyte IF233
Cooling
1 x 120mm Front Inlet 1 x 120mm Rear Exhaust
Keyboard
Microsoft Comfort Curve Keyboard 3000 (USB)
Mouse
Microsoft Comfort Mouse 3000 for Business (USB)
Internet Speed
NetGear DG834Gv3 ADSL Modem/Router (Ethernet) ~4.0 Mb/s (O2)
Antivirus
Avast! 8.0.1497
Browser
IE 11
Other Info
Optical Drive: HL-DT-ST BD-RE BH10LS30 SATA Bluray
Lexmark S305 Printer/Scanner/Copier (USB)
WEI Score: 8.1/8.1/8.5/8.5/8.25
Asus Eee PC 1011PX Netbook (Windows 7 x86 Starter)
Back
Top