Comparing a number without dimensional units with one that has dimensional units?

InOverMyH3ad

New Member
Joined
Sep 17, 2018
Messages
13
Office Version
  1. 365
Platform
  1. Windows
Scenario:

Cell A: 12
Cell B: 12" (or even 12 in.)

Cell A will never have units. It will always be cell B that will be the issue. I'm trying to figure out a way to be able to compare the two cells and determine if they are equal or what the difference between them us. The issue is getting excel to ignore the units after the numbers. Is this possible in some sort of non-VB way?
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Hello, could you please first share with us what version of Excel are you using?
 
Upvote 0
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
Please test the following for a number with additional signs:

Excel Formula:
--(CONCAT(IFERROR(--(MID(B1,SEQUENCE(LEN(B1)),1)),"")))
 
Upvote 0
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
Got it. Thank you.
 
Upvote 0
Please test the following for a number with additional signs:

Excel Formula:
--(CONCAT(IFERROR(--(MID(B1,SEQUENCE(LEN(B1)),1)),"")))

To start, thank you for your help. This gets me close, but I didn't realize there might be a situation where I have something like 16.5 in or 16.5". The code you graciously provided is giving me 165 as an output for that. It's doing too good of a job removing punctuation.
 
Upvote 0
Many thanks, yeah, my bad for not considering that option. Another attempt:

Excel Formula:
=LET(
a,B1,
b,LEN(a),
c,ISNUMBER(--(MID(a,SEQUENCE(b),1))),
d,SEQUENCE(b),
e,IF(c*d=0,"",c*d),
MID(a,MIN(e),MAX(e)-MIN(e)+1))
 
Upvote 0
Another option:
Book1
AB
212"12
312 in12
412.5 in12.5
516.584 in16.584
616.582 "16.582
7It's 3.5 inches long3.5
Sheet3
Cell Formulas
RangeFormula
B2:B7B2=LET(t,TOCOL(SEARCH(SEQUENCE(10,,0),A2),2),--MID(A2,MIN(t),MAX(t)-MIN(t)+1))
 
Upvote 0

Forum statistics

Threads
1,224,525
Messages
6,179,319
Members
452,905
Latest member
deadwings

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