Compare first 2 integer and show difference

alvbnp

Board Regular
Joined
Jun 26, 2006
Messages
180
Sample data:

A1 | B1
15/01/2006 | 17/07/2006

in C1, show the differences between 17 and 15, which is 2

A1 and B1 both inputted in date format, I tried using the formula
Code:
=left(A1,2)
and it's not working.

Thanks.
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

JohnnyTightlips

Board Regular
Joined
Aug 13, 2006
Messages
94
If you are comparing dates, DATEDIF would be the feature to use:

=DATEDIF(A1,B1,"D")

Where "D" means diiference in days
 

alvbnp

Board Regular
Joined
Jun 26, 2006
Messages
180
Thanks for replying. But I only want to compare the first two digit, nothing to do with the date. Strictly first 2 digit in B1 - first 2 digit in A1.
 

Forum statistics

Threads
1,171,973
Messages
5,878,558
Members
433,351
Latest member
Cindy Little

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
Top