cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

How detect a string in excel

Hi,

 

I trying to make a flow that take two numbers from excel and add it, but when the cell contains (for human mistake) a letter the flow stop because the float function fail. My line is:

 

 

add(float(if(or(or(equals(body('TABLE')?['A'], ''), equals(body('TABLE')?['A'], '#¡DIV/0!')), equals(body('TABLE')?['A'], '#¡VALOR!')), 0, body('TABLE')?['A'], '')), float(if(or(or(equals(body('TABLE')?['B'], ''), equals(body('TABLE')?['B'], '#¡DIV/0!')), equals(body('TABLE')?['B'], '#¡VALOR!')), 0, body('TABLE')?['B'], ''))

 

 

I want to put a 0 if when the cell doesn't content a number, so how can I detect if the cell contains a string character? 

Thanks.

4 REPLIES 4
Highlighted
Super User II
Super User II

Re: How detect a string in excel

Hi @brayanrm0097 

 

One way to check if character contains 0-9 and if not use 0.

Here is an example:

MyString - Created for testing ( this is your cell value)

Number - Array of 0-9

Expression - if(contains(variables('NumberArray'),variables('MyString')),variables('MyString'),0)

CheckNo.png

-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Highlighted
Frequent Visitor

Re: How detect a string in excel

But how can I do for letters?
I want to know if a cell have only numbers or not

Thanks.
Highlighted
Super User II
Super User II

Re: How detect a string in excel

Hi @brayanrm0097 

 

This will do the same, what i am checking if cell has any number if not use 0.

 

-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Highlighted
Frequent Visitor

Re: How detect a string in excel

Hi, thanks for reply,
I tried if(contains(variables('numbers'), body('get_row')?['D']), body('get_row')?['D'], 0)

But always return 0, because the "contains" function always return False, why?

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (5,843)