Google Sheet, IFS function with a range condition

13 Feb, 2025

A

B

C

Remaining Lease

Remain Years

Remain Years Lease

61 years 04 months

21 years 07 months

82 years

The conditions are:

· If the data is less than 50, then I need to return the value Under 50 years.

· If the data is from 50 to 80, then return the value 50 - 80 years.

· If the data is greate than 80, then return the value More than 80 years.

First, round down first column using =left(A2, 2)

A

B

C

Remaining Lease

Remain Years

Remain Years Lease

61 years 04 months

61

21 years 07 months

21

82 years

82

Then follow Googlesheet instruction , return the value using:

=IF(B2<50, "Under 50 years", IF(B2>80, "More than 80 years", "50 - 80 years"))

The formula is trying to categorize values in B2, but B2 is derived from =LEFT(A2, 2), which extracts the first two characters from A2. Since LEFT(B2, 2) returns text, the IF statement might not work as expected if A2 contains text values.

A

B

C

Remaining Lease

Remain Years

Remain Years Lease

61 years 04 months

61

More than 80 years

21 years 07 months

21

More than 80 years

82 years

82

More than 80 years

To ensure it works correctly, wrap LEFT(I2, 2) with VALUE() to convert it to a number:

=IF(VALUE(B2)<50, "Under 50 years", IF(VALUE(B2)>80, "More than 80 years", "50 - 80 years"))

A

B

C

Remaining Lease

Remain Years

Remain Years Lease

61 years 04 months

61

50 - 80 years

21 years 07 months

21

Under 50 years

82 years

82

More than 80 years