Searching using wildcards only at start of Cell

Cupid Stunt

New Member
Joined
Sep 28, 2014
Messages
16
Hi,

Please could someone help

I need a formula that will return true if start of a cell contains any number with 2 decimal places then a space then a hyphen. the cell could also contain any other text after this.

i.e. "201.11 -pjkdlsg" would return True

but "sdjklg 201.11 -ppsdfg" would return False

The 201.11 - must be at the start of the cell.

I am currently using IF(COUNT(SEARCH("?.?? -*",H3))>0,"false","true") but this searches the whole cell and returns true is 201.11 - is anywhere in the cell not just the start.
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Try...

=ISNUMBER(LEFT(H3,FIND(" ",H3))+0)

This assumes a space after an admmissible number at the start of a string.
 
Upvote 0
Hi,

Please could someone help

I need a formula that will return true if start of a cell contains any number with 2 decimal places then a space then a hyphen. the cell could also contain any other text after this.

i.e. "201.11 -pjkdlsg" would return True

but "sdjklg 201.11 -ppsdfg" would return False

The 201.11 - must be at the start of the cell.

I am currently using IF(COUNT(SEARCH("?.?? -*",H3))>0,"false","true") but this searches the whole cell and returns true is 201.11 - is anywhere in the cell not just the start.
This returns False if not exactly 2 decimal places.
Excel Workbook
AB
1201.112 -pjkdlsgFALSE
2djklg 201.11 -ppsdfgFALSE
Sheet10
 
Upvote 0
Try...

=ISNUMBER(LEFT(H3,FIND(" ",H3))+0)

This assumes a space after an admmissible number at the start of a string.


So close!!!

Problem i have is formula must only return True if the number has a hyphen after the space, this returns true if the hyphen is missing
 
Upvote 0
This returns False if not exactly 2 decimal places.
Sheet10

AB
1201.112 -pjkdlsgFALSE
2djklg 201.11 -ppsdfgFALSE

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:131px;"><col style="width:64px;"></colgroup><tbody>
</tbody>

Spreadsheet Formulas
CellFormula
B1=AND(ISNUMBER(0+LEFT(A1,SEARCH(".",A1)-1)),LEN(MID(A1,SEARCH(".",A1),SEARCH(" -",A1)-SEARCH(".",A1)-1))=2)
B2=AND(ISNUMBER(0+LEFT(A2,SEARCH(".",A2)-1)),LEN(MID(A2,SEARCH(".",A2),SEARCH(" -",A2)-SEARCH(".",A2)-1))=2)

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4

Again soooo close to what i need but also returns True if there are spaces at the start of the cell
 
Upvote 0
Modified Alaadin's formula a little


Excel 2010
AB
1201.11 -pjkdlsgFALSE
Sheet2
Cell Formulas
RangeFormula
B1=ISNUMBER(LEFT(A1,FIND("-",A1)-1)+0)*(TRIM(A1)=A1)>0
 
Upvote 0
Combined the two and looks like it's done the trick! :)

=AND(ISNUMBER(LEFT(H3,FIND(" ",H3))+0),LEN(MID(H3,SEARCH(".",H3),SEARCH(" -",H3)-SEARCH(".",H3)-1))=2)

Thanks so much Joe & Aladin
 
Upvote 0
Combined the two and looks like it's done the trick! :)

=AND(ISNUMBER(LEFT(H3,FIND(" ",H3))+0),LEN(MID(H3,SEARCH(".",H3),SEARCH(" -",H3)-SEARCH(".",H3)-1))=2)

Thanks so much Joe & Aladin

Are you trying to avoid yielding TRUE for numbers with one or leading spaces?
 
Upvote 0

Forum statistics

Threads
1,214,980
Messages
6,122,563
Members
449,088
Latest member
Motoracer88

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