Formula to Caluclate difference separated by Hyphen in Single Cell

petes

Board Regular
Joined
Sep 12, 2009
Messages
168
All - Need Some help on Formula to calculate the difference for the figures appearing in single separated by Hyphen

In Column A of Excel I have values like:

413.0-413.1 in A1
414.00-414.07 in A2
414.10-414.12 in A4

I need a formula in Column B that will display the Result as:

2 in B1 for A1
8 in B2 for A2
3 in B3 for A4

Actullay, the Result is the difference in figures between the hyphen (-) and adding 1 to it. Since it is in the single cell, i am not able to think of any formula

Any Thoughts?? Thanks!!
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Thanks for the quick Reply... It is working Perfect if the Format of Column A is "Number". But Actually my format is "Text" and hence displaying #Value!

Whether any changes can be done??
 
Upvote 0
Thanks for the quick Reply... It is working Perfect if the Format of Column A is "Number". But Actually my format is "Text" and hence displaying #Value!

Whether any changes can be done??

It works for me regardless of the format. Try this:
=RIGHT(D1)+0-MID(D1,FIND("-",D1)-1,1)+1
 
Upvote 0
Not Sure why I am getting #Value! in my spreadsheet... i will look into it and will let you know.

Thanks
 
Upvote 0
One Observation - If I manually type the same values in Column A again, I am getting the correct result. But there are thousands of records... not sure whatz the issue??
 
Upvote 0
Try using Text To Columns on the entire column - changing the format from Text to General.
 
Upvote 0
In the first row of your example you have a single digit after the decimal point, in the next two examples you have 2 digits. Assuming that each cell has the same number for both (1 or 2) and that the number before the decimal is always the same try

=RIGHT(A1,LEN(A1)-FIND(".",A1,LEN(A1)-3))-MID(A1,FIND(".",A1)+1,LEN(A1)-FIND(".",A1,LEN(A1)-3))+1
 
Upvote 0
Not Sure why I am getting #Value! in my spreadsheet... i will look into it and will let you know.

Thanks
You might have trailing whitespace characters in your data.

For example:

413.0-413.1

Might actually be:

413.0-413.1[space]

That will cause the #VALUE! error.

Try this tweak of njimack's formula:

=RIGHT(TRIM(A1))-MID(A1,FIND("-",A1)-1,1)+1
 
Upvote 0
after all my research and headache, I came to know that, it is NOT the Hyphen that is separating figures, but actually it is a Symbol (charcter code 2500).


Any formula available for this type of scenario...

Thanks!!
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,591
Messages
6,179,768
Members
452,940
Latest member
rootytrip

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