If a text cell contains value greater than

koksalcanberk

New Member
Joined
May 20, 2020
Messages
7
Office Version
  1. 2019
Platform
  1. Windows
Hello,

I want excel to return TRUE if a text cell contains value greater than 2500.

For example, it has to return TRUE for the cell with "John-2504-Doe" in it.

For the cell with "John-2010-Doe" in it, on the other hand, it has to return FALSE.

Is this possible to do?

Best,
C
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Could you give a couple of examples of what was in cells that it failed to detect?

Good news. You're welcome. Thanks for the follow-up. :)

Sure thing!

I actually tried hard to notice a pattern, but failed to do so. But as much as I can see, when there's a "/" or "-" before OR after the value, the code fails to detect it. Having said that, when there's "/" or "-" before AND after the value, it does get detected. When the value takes place at the very end, such as "John-Doe-3450", it doesn't get detected either.

There are too many data though. So I'm not sure with any of these. Unfortunately my data set is confidential, so I'm not able to share it :(
 
Upvote 0
as much as I can see, when there's a "/" or "-" before OR after the value, the code fails to detect it. Having said that, when there's "/" or "-" before AND after the value, it does get detected. When the value takes place at the very end, such as "John-Doe-3450", it doesn't get detected either.
Hmm, I don't know what is going on with your sheet then as both work for me for all those cases if I have understood correctly. These are what you are describing as failures for the first function aren't they?

koksalcanberk 2020-05-20 1.xlsm
ABC
1John/2504DoeTRUETRUE
2John2710/DoeTRUETRUE
3John-Doe-3450TRUETRUE
Sheet1
Cell Formulas
RangeFormula
B1:B3B1=GreaterThan(A1)
C1:C3C1=Greater_Than(A1)
 
Upvote 0
Hmm, I don't know what is going on with your sheet then as both work for me for all those cases if I have understood correctly. These are what you are describing as failures for the first function aren't they?

koksalcanberk 2020-05-20 1.xlsm
ABC
1John/2504DoeTRUETRUE
2John2710/DoeTRUETRUE
3John-Doe-3450TRUETRUE
Sheet1
Cell Formulas
RangeFormula
B1:B3B1=GreaterThan(A1)
C1:C3C1=Greater_Than(A1)

I'm sorry, I just saw this Peter. Yes, that's actually what I wanted to do so, no idea what was going on with my sheet! Maybe I observed it wrong.

The reason I came back to this thread was because I wanted to ask how can I apply this VBA code into a document in Google Sheets and not in my local computer. Is this possible?
 
Upvote 0
I know I am late to this thread, but here is another UDF (user defined function ) that I think should also work...
VBA Code:
Function GreaterThan(ByVal S As String, Optional Lower As Long = 2500) As Boolean
  Dim X As Long
  For X = 1 To Len(S)
    GreaterThan = Val(Mid(S, X)) > Lower
    If GreaterThan Then Exit For
  Next
End Function
 
Upvote 0

Forum statistics

Threads
1,214,921
Messages
6,122,280
Members
449,075
Latest member
staticfluids

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