Forum Discussion

Matt_Mys's avatar
Matt_Mys
Copper Contributor
Aug 29, 2022
Solved

ANSWERED - Making a formula count the number of digits in a cell before executing

Edit - I got the answer I needed. Thank you!

 

Hello all,

 

I am trying to get a formula to count how many digits are in a cell, and if they contain a certain amount of digits, then (do the rest of the formula I already have).

 

For example, if the cell has 1 digit, I dont want it to do anything, but if it has 2, 3, or 4 digits, I want it to do something. Is there a way to do that?

  • sivakumarrj's avatar
    sivakumarrj
    Brass Contributor
    Based on Number of digits you can do multiple formulas using conditional if
    9 2 0
    12 3 36
    15 4 60
    150 5 750
    2000 1 2000
    =IF(A1>=10,(A1*B1),0)
    From the above formula If value is single digit will not do any calculation,
    if it has more than 2 digit calculation can be done with using multiplication, division or substract etc.
  • Harun24HR's avatar
    Harun24HR
    Bronze Contributor
    =IF(LEN(A1)>1,"do something","do nothing")
    • Matt_Mys's avatar
      Matt_Mys
      Copper Contributor
      This was the one I needed. This did exactly what I was looking for. Thank you so much!
  • LuanGomes's avatar
    LuanGomes
    Copper Contributor
    Hello, try this formula
    =IF(NÚM.CARACT(C5) = 2,"EXISTS 2 CHARACTERS","ERROR")

Resources