Search code examples
regexvalidationgoogle-sheetsgoogle-sheets-formulags-conditional-formatting

How to make a data validation to accept only whole number if next cell contains certain text


I have a table like this :

enter image description here

When I select a product with data validation in column B I get automatically the unit in column F

For example I type Product 1 in B3, and in F3 I get "Kilo" , if its product 2 I get "Piece"

What im trying to do is: If F3 <> Kilo (meaning is piece, box etc), in D3 to allow only whole numbers, but if F3 = "Kilo" then allow decimal numbers as well

And I need this to apply for the entire column


Also im tryng to format column D based on F if F3 = Kilo then have a format like "#.##"
But if F3 <> Kilo to have only the format as "##" without decimals, only 1,3,7, 15, 30 etc


I have been looking for a solution but I don't get it

Any help please ?


Solution

  • try:

    =((F2="pz")*(NOT(REGEXMATCH(""&D2, "\.|,"))))+(F2<>"pz")
    

    0