Forum

Notifications
Clear all

Check If Cell Begins with another cell

6 Posts
3 Users
0 Reactions
206 Views
(@marsil)
Posts: 72
Estimable Member
Topic starter
 

Hi,

Could you please help me to edit below function to let me know If Cell Begins with another cell or not. 

=IF(LEFT(TRIM(A2),1)="s","OK","Not OK") 

My target is check if Numbers in A2 start with C2 values.

Phone Status Key
8475755 No 87
435566 Yes 4
436576 Yes 4365
 
Posted : 28/04/2020 12:13 pm
(@purfleet)
Posts: 412
Reputable Member
 

Its always better to upload an example workbook so we know how the data is setup

Are you after something like this?

=IF(TRIM(LEFT(A2,LEN(C2)))+0=C2,"Ok","not Ok")

Purfleet

 
Posted : 28/04/2020 3:07 pm
(@marsil)
Posts: 72
Estimable Member
Topic starter
 

Hi Purfleet,

It works perfectly, Thank you very much!

Is this other function for characters? please check attached file.
 

Grateful for your support..

Thanks;

Marsil

 
Posted : 28/04/2020 5:54 pm
(@purfleet)
Posts: 412
Reputable Member
 

Hi Marsil

Nothing attached, but to break it down (I am sure you know most of it)

=IF(TRIM(LEFT(A2,LEN(C2)))+0=C2,"Ok","not Ok")

Len(C2) gets the number of characters to check

Left(a2) gets the left characters for the number of the above Len

Trim makes sure there is no random spaces

and if makes the determination

the +0 makes the text from the trim/left/len into a number

Hope that helps

 
Posted : 29/04/2020 12:01 pm
(@marsil)
Posts: 72
Estimable Member
Topic starter
 

Hi Purfleet,

Thank you very much; your support is greatly appreciated.

Please check attached file and try to handle the function please.

Thanks;

Marsil

 
Posted : 01/05/2020 8:34 am
(@debaser)
Posts: 838
Member Moderator
 

Just remove the +0 from the formula, since your values are not numeric. If you need to handle both numbers and text in the same formula, you could use:

 

=IF(TRIM(LEFT(A2,LEN(C2)))=""&C2,"Yes","No")

 
Posted : 01/05/2020 10:08 am
Share: