How to check if a cell contains "%" and calculate accordingly.

Solved/Closed
N245 - 24 Mar 2015 à 18:04
 Saurabh - 18 Oct 2019 à 14:46
I am wondering how to do that?

I learnt no basics, just went on by myself trying to figure out things and so here is what I am trying to do..

Basically, if cell B2 contains a whole number (say 10), then cell C2 returns that flat value, but if cell B2 contains a percentage, then C2 performs a simple equation (i.e.: B2*B1)

It's just I am not sure how to define if a cell has a specific symbol/text so it can perform the equation needed, else disregard.

How I vision it could've been (tried but failed)"
IF(B2="#%", B2*B1, B2) -- if I understood that function correctly, if B2 contains a percentage, it would multiply B2 by B1, if not, it will return B2 value.. regardless of that, it always returns B2 value, even if it is with a percentage.

Help will be appreciated.


Related:

2 responses

MaxStart Posts 338 Registration date Tuesday 3 March 2015 Status Contributor Last seen 3 July 2015 69
25 Mar 2015 à 19:23
=IF(RIGHT(B2,1)="%",B2*B1,B2)

please follow-up with us if it works for you.
--
Damn it !!!, is it ever gonna be the way I want it to be?
Works like a charm!

Could you possibly explain what does the function "right" mean?
MaxStart Posts 338 Registration date Tuesday 3 March 2015 Status Contributor Last seen 3 July 2015 69
26 Mar 2015 à 04:46
it will return characters from the string starting from the right, number of characters in this case is 1
Thanks Max