formula or macro to analyze dimensions

Kermy812

New Member
Joined
Feb 22, 2018
Messages
10
Can any one help me with a formula or macro to analyze dimensions?
My column has many sizes listed, but I need to change it or mark in another column that it's too big fit in my area of 12.375x18.375.
For instance, I have these sizes below, they would be marked too big cause they don't fit:
18x18​
10x55​
20x2.5​
20x.75​
5x24
32x10​

I'm just doing a macro with a simple find & replace now, but I have about 50ish find/replaces and my list keeps growing:
Columns("K:K").Select​
Selection.Replace What:="18x18", Replacement:="TOO BIG", LookAt:=xlPart, _​
SearchOrder:=xlByRows, MatchCase:=False​

These sizes would be left alone or not noted as they would fit:
5.5x7​
11x17​
8.5x11​
2x18​
12x18​
18x12 (this would fit, cause it would be rotated to 12x18 fit my area)​

I think the logic would be:
if the number on either side of the "x" is greater than 18.375 then text "TOO BIG"
or​
if both numbers on either side of the "x" are greater than 12.375 then text "TOO BIG"

Any help would be appreciated...
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Here's a user-defined function (UDF) you can use just like a worksheet function after you install it.
Excel Workbook
BC
118x18Too Big
210x55Too Big
320x2.5Too Big
420x.75Too Big
55x24Too Big
632x10Too Big
75.5x7OK
811x17OK
98.5x11OK
102x18OK
1112x18OK
1218x12OK
1025-ZUT-abc-A



Code:
Function TooBigTest(S As String) As String
Dim V As Variant
If S = "" Then
    TooBigTest = ""
    Exit Function
End If
V = Split(S, "x")
If V(0) > 12.375 And V(1) > 18.375 Then
    TooBigTest = "Too Big"
    Exit Function
ElseIf V(0) > 18.375 Or V(1) > 18.375 Then
    TooBigTest = "Too Big"
    Exit Function
ElseIf V(0) > 12.375 And V(1) > 12.375 Then
    TooBigTest = "Too Big"
    Exit Function
End If
TooBigTest = "OK"
End Function
 
Upvote 0
Thanks Joe! This worked Great!
I did tweak a little bit as the first as "if" statement wasn't needed, then to return the values if not "too big", so I can sort later:
Code:
Function TooBigTest(S As String) As StringDim V As Variant
If S = "" Then
    TooBigTest = ""
    Exit Function
End If
V = Split(S, "x")


If V(0) > 18.375 Or V(1) > 18.375 Then
    TooBigTest = "TOO BIG"
    Exit Function
ElseIf V(0) > 12.375 And V(1) > 12.375 Then
    TooBigTest = "TOO BIG"
    Exit Function
End If
TooBigTest = S
End Function

So my results on column B would be:

[TABLE="class: grid, width: 400, align: left"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]3x5[/TD]
[TD]3x5[/TD]
[/TR]
[TR]
[TD]5x7[/TD]
[TD]5x7[/TD]
[/TR]
[TR]
[TD]32x10[/TD]
[TD]TOO BIG[/TD]
[/TR]
[TR]
[TD]8.5x11[/TD]
[TD]8.5x11[/TD]
[/TR]
[TR]
[TD]12x18[/TD]
[TD]12x18[/TD]
[/TR]
[TR]
[TD]18x12[/TD]
[TD]18x12[/TD]
[/TR]
[TR]
[TD]13x13[/TD]
[TD]TOO BIG[/TD]
[/TR]
[TR]
[TD]13x2[/TD]
[TD]13x2[/TD]
[/TR]
</tbody>[/TABLE]

Again, thanks a bunch, I really appreciate it!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

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