Simple subtraction

elersbuh

New Member
Joined
Oct 9, 2023
Messages
7
Office Version
  1. 365
Platform
  1. Windows
I am trying use a simple subtraction formula on excel referencing values that appear using a vlookup.

As you can see in the image below, you can enter a point number in B36 and B37, the relevant easting and northing for both points will appear in adjacent cells. What I am trying to do is calculate the delta easting/northing between both points. It is a simple subtraction but when whenever I try to input the formula is does not work and I am not too sure why?
 

Attachments

  • excel.png
    excel.png
    21.4 KB · Views: 12

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Numbers that are left aligned like you have in C36 & C37 are a strong indicator that Excel is seeing them as being text.
One option would be:
Excel Formula:
=VALUE(C37)-VALUE(C36)

It preferable to handle as close to the source as possible, so ideally the sheet you are looking up, if not there then in the vlookup (wrap the result in Value(Vlookup()), the above is the last resort.
 
Upvote 0
Thanks for the tip. It has not worked yet and I think its because cells C36:D37 all have separate vlookup formulas in each of them and when referencing the cell to be subtracted its seeing the formula in the cell and not the value? I am pretty new to using excel like this so had to keep things as basic as I could but Im just not too sure how to go about it.
 
Upvote 0
Ideally instal the Mr Excel XL2BB add-in and post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

In the meantime show us your vlookup formula in the same way you showed the subtraction formula and also show us the data where the coming from (again showing it both in the cell and the formula bar).
 
Upvote 0
CPPSIS5060 EXCELL Assessment 1 Worksheet.xlsx
ABCDEFG
23PointEastingsNorthings
241567768 6376890
252567702 6376035
263567835 6377836
274567936 6376471
285568035 6376044
296566834 6377837
307567413 6378635
318566036 6378999
329568634 6377941
3310566345 6376534
34
35
36FROMTO
37Point 65TOTAL DISTANCE
38Easting566834 568035 Delta E
39Northing6377837 6376044 Delta N
Sheet1
Cell Formulas
RangeFormula
C38:D38C38=VLOOKUP(C37,Table2,2,FALSE)
C39:D39C39=VLOOKUP(C37,Table2,3,FALSE)
 
Upvote 0
I need a formula of some sort in both cell F38 and F39 that can ignore the formula in those cells and subtract the values that appear in the relevant cells.

e.g if you enter any point number in cell C37 or D37 the E/N values will appear in the cells below.
 
Upvote 0
It seems to be working for me.

Can you try and put the length formulas I have here and see if they match the length of the number (ie do you have any non-printing characters in your data that didn't come through in the XL2BB

Book2
ABCDEFG
23PointEastingsNorthings
2415677686376890
2525677026376035
2635678356377836
2745679366376471
2855680356376044
2965668346377837
3075674136378635
3185660366378999
3295686346377941
33105663456376534
34
35
36FROMTO
37Point 65TOTAL DISTANCE
38Easting566834568035Delta E1201
39Northing63778376376044Delta N-1793
40
41Length
42Easting66
43Northing77
Sheet1
Cell Formulas
RangeFormula
C38:D38C38=VLOOKUP(C$37,Table2,2,FALSE)
C39:D39C39=VLOOKUP(C$37,Table2,3,FALSE)
G38:G39G38=D38-C38
C42:D43C42=LEN(C38)
 
Upvote 0
CPPSIS5060 EXCELL Assessment 1 Worksheet.xlsx
LMNOPQR
23PointEastingsNorthings
2415677686376890
2525677026376035
2635678356377836
2745679366376471
2855680356376044
2965668346377837
3075674136378635
3185660366378999
3295686346377941
33105663456376534
34
35
36FROMTO
37Point 65TOTAL DISTANCE
38Easting566834 568035 Delta E#VALUE!
39Northing6377837 6376044 Delta N#VALUE!
40
41Length
42Easting77
43Northing88
44
Sheet1
Cell Formulas
RangeFormula
M38:N38M38=VLOOKUP(C$37,Table2,2,FALSE)
M39:N39M39=VLOOKUP(C$37,Table2,3,FALSE)
Q38:Q39Q38=D38-C38
M42:N43M42=LEN(C38)
 
Upvote 0
I copy and pasted your working onto excel and this the result. I havent changed anything from what you have done but there is obviously some issue with my excel program?
 
Upvote 0
It's more likely your source data. Did you get it from the internet ?

What do get if you enter
=unicode(right(c38,1))
 
Upvote 0

Forum statistics

Threads
1,215,084
Messages
6,123,029
Members
449,092
Latest member
ikke

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