Add Row Numbers And Skip Blanks in Google Sheets

Do you ever have to input a list of numbers into a spreadsheet in Google Sheets, and some of the cells are blank? It can be difficult to keep track of what number is in which cell when you have to scroll up and down the sheet to look for the right spot. Well, today, I’m going to show you how to add row numbers and skip blanks in Google Sheets so that your data entry process is a little bit smoother. Let’s get started!

Add Row Numbers And Skip Blanks in google sheets1

Generic formula in Google Sheets

=IF(ISBLANK(B2),"",COUNTA($B $2: B 2))

Summary

To add row numbers to a list of data, skipping blank cells in Google Sheets, you can use the formula based on COUNTA and ISBLANK. Just using the following formula:

=IF(ISBLANK(B2),"",COUNTA($B$2:B2))

Add Row Numbers And Skip Blanks in google sheets1

A simple way is to use IF statements with anondata formulas to show certain information when it comes up while keeping other things hidden from view unless desired by users who will open them up specifically looking for these details themselves!

Explanation 

The purpose is to add row numbers in column A only when there’s a value present elsewhere.

The IF function checks whether or not cell B2 has any values with ISBLANK.

=ISBLANK(B2) // FALSE if not, TRUE if empty

Add Row Numbers And Skip Blanks in google sheets1

When B2 is empty, ISBLANK returns TRUE, and the IF function produces a plain string like this: “”. If there’s anything in between them (i.e., not an expandable reference), we get COUNTA with whatever values are stored at each cell of that array; namely, nothing if it exists or NaN for non-numbers.

=COUNTA($B$2:B2) // expanding range

Add Row Numbers And Skip Blanks in google sheets1

As the formula is copied down, each row’s count expands to include all non-blank cells in that range. COUNTA will count both numbers and text, making it easy for you to determine who was counting what during your data entry!

Method2: Autonumber Rows If Adjacent Cell Not Blank in Google Sheets

The easiest way to auto number your column is by using this formula: =IF(B2<>””,COUNTA($B$2:B2),””) and then dragging down with the filehandle. You can also add row numbers manually if you want, but why not make things easier on yourself in Google Sheets?

Add Row Numbers And Skip Blanks in google sheets1

Note: When you enter a formula to auto number cells, make sure that B2 is populated with the relevant value.

Entering new data or deleting existing values will automatically cause the sequence number in column A to be renumbered.

Related Functions

  • Google Sheets ISBLANK function
    The Google Sheets ISBLANK function returns TRUE if the value is blank or null.The syntax of the ISBLANK function is as below:= ISBLANK (value)…
  • Google Sheets IF function
    The Google Sheets IF function perform a logical test to return one value if the condition is TRUE and return another value if the condition is FALSE. The IF function is a build-in function in Microsoft Excel and it is categorized as a Logical Function.The syntax of the IF function is as below:= IF (condition, [true_value], [false_value])….
  • Google Sheets COUNTA function
    The Google Sheets COUNTA function counts the number of cells that are not empty in a range. The syntax of the COUNTA function is as below:= COUNTA(value1, [value2],…)…

 

Google Sheets Nexted IF Functions (Statements) Tutorial (15 IF Formulas examples)

This tutorial will guide you how to use nested Google Sheets IF function  (include multiple If statements in Google Sheets formula) with syntax and provide about 15 nested IF formula examples with the detailed explanation in Google Spreadsheets.

Description

The Google Sheets IF function perform a logical test to return one value if the condition statement is TRUE and return another value if the condition statement is FALSE. The IF function is a build-in function in Google Spreadsheets and it is categorized as a Logical Function.

The Google Sheets if function just only test one condition and if you want to deal with more than one condition and return different actions depending on the result of the tests,  then you need to include several IF statements (functions) in one Google Sheets IF formula, these multiple IF statements are also called Google Sheets Nested IF formula(Nested IFs). It’s also similar with IF-THEN-ELSE statement.

The nested IF function is formed by multiple if statements within one Google Sheets if function. This Google Sheets nested if statement makes it possible for a single formula to take multiple actions.

Syntax

The syntax of Nested IF function is as below:

=IF(Condition_1,Value_if_True_1,IF(Condition_2,Value_if_True_2,Value_if_False_2))

Where the Nested IF function argument is:

  • Condition_1 –  The condition that you want to test  in the first IF statement.
  • Value_if_True_1The value that is returned if first IF statement is True. If the condition_1 return False, then move into the next IF function.
  • Condition_2The condition that you want to test in the second IF statement.
  • Value_if_True_2The value that is returned if second IF statement is True.
  • Value_if_False_2The value is returned if second IF statement is False.

This is equivalent to the following IF THEN ELSE statement:

IF Condition_1 THEN
    Value_if_True_1
ELSEIF Condition_2
    Value_if_True_2
ELSE
    Value_if_False_2
END IF

Examples of Nested IF function (Statement) in Google Sheets

The below examples will show you how to use Google Sheets Nested IF function with the detailed explanation of their syntax and logic.

Example 1#  The most basic Nested IF function with one level of nesting

If you want to write a nested if function to test the following calculation logic for assigning value in the cell A1.

IF A1 =="excelhow" THEN
    return "Google Sheets "
ELSEIF A1 == "excelhow.net" THEN
    return "Google Spreadsheets "
ELSE
    return "GS"END
 IF

we can write a nested IF function based on the above logic as follows:

=IF(A1="excelhow", "Google Sheets", IF(A1="excelhow.net"," Google Spreadsheets","GS"))

google sheets nested if function1

In above Nested IF formula, the nested if function is is inside the outer IF function. we can see that if A1 is not equal to the “excelhow“, then the second nested  IF function will be test. and if second IF condition statement return FALSE, then the entire IF function will return “GS” value.

Example 2#  The Nested IF function with two levels of nesting

Assuming that you want to test more than one condition statement in the above nested if function, add one condition to test if the value of the cell A1 reference is equal to “www.excelhow.net” , If TRUE, then return “google spreadsheets “.

The calculation Logic is as below:

IF A1 =="excelhow" THEN
    return "google"
ELSEIF A1 == "excelhow.com" THEN
    return "google sheets"
ELSEIF A1 == "www.excelhow.net" THEN
    return "google spreadsheets"
ELSE    return "gs"
END IF

we can add one more IF statement inside the second IF function in the above google sheets nested if formula in example1. let’s see the below nested if function with tow level nesting:

=IF(A1="excelhow", "google", IF(A1="excelhow.com"," google sheets",IF(A1="www.excelhow.net","google spreadsheets","gs")))

google sheets nested if function1

In the above nested google sheets IF formula, the first nested if function is marked with red color, and the second nested google sheets if function is marked with blue color.

If the both first and second conditions are False and the third IF condition will be check, IF A1 is equal to “www.excelhow.net” , then return “google spreadsheets “, or the entire nested IF formula will return “gs“.

Example 3#  Describes the each IF function contained in the nested IF function

​We will use one typical example of google sheets nested if function to describe each IF function included in the nested if function.

Assuming that you need to assign a grade based on a score with the following test conditions:

Score Grade
80-100 excellent
60-79 good
0-59 bad

Let’s write a nested if function based on the above logic as follows:

=IF(A1>=80, "excellent", IF(A1>=60, "good", IF(A1>0, "bad", "no valid score")))

google sheets nested if function1

For the above google sheets if formula, lets describe it for each IF function statement.

1# IF Cell A1 is greater than or equal to 80, then the formula will return “excellent” or move to the second If function.

2# If Cell A1 is greater than or equal to 60, then the formula will return  “good” or move to the third IF function

3# IF Cell A1 is greater than 0, then the formula will return “bad”, or the IF function will return “no valid score”.

Example 4#  Describes each If function in the google sheets Nested IF Statement (another simple example of if function)

Let’s describe the below Nested IF Function example:

=IF(A1<=6,60, IF(A1<=8,80,IF(A1<=10,100,200)))

a) If cell A1 is equal to 6 or less than 6, then return value 60 in cell C1. Let’s see below screenshot.

google sheets nested if function1

b) If Cell A1 is greater than 6 and less or equal to 8, then retrun value 80 in Cell C1.

google sheets nested if function1

c) If cell A1 is greater than 8 and less than or equal to 10, then return value 100 in cell C1.

google sheets nested if function1

d) If cell A1 is greater than 10 , then the Nested if function will return the last value “200”in cell C1.

google sheets nested if function1

Example 5#  Google Sheets Nested IF function with arithmetic operator (+, -, * , /)

Assuming that you want to write a Nested If function to reflect the following logic tasks:

a) IF Cell A1 is less than 10, then multiply by 10.

b) IF Cell A1 is greater than or equal to 10 but less than 20, then add 20

c) IF Cell A1 is greater than or equal to 20 but less than 30, then minus 20

d) IF Cell A1 is greater than or equal to 30 but less than 50, then divided by 20

The nested IF formula is as follows:

=IF(A1<10,A1*10,IF(A1<20,A1+20,IF(A1<30,A1-20,IF(A1<50,A1/20))))

google sheets nested if function1

a1) if Cell A1 is less 10 (A1=5), then the first If condition matched and will take multiply action, A1 * 10=5*10=50, so it will return 50 in the cell C1

b1) if Cell 10<=A1<20 (A1=15), then the second if condition matched and will take add action, A1+20=15+20=35, so it will return 35 in the cell C1.

c1) if Cell 20<=A1<30(A1=25), then the third if condition matched and will take minus action, A1-20=25-20=5, so it will return 5 in the cell C1.

d1) if Cell 30<=A1<50 (A1=35), then the forth if condition matched and will take divide action, A1/20=35/20=1.75, so it will return 1.75 in the cell C1.

Example 6#  Google Sheets Nested IF function with logical function –AND

Assuming that you need a nested if function to reflect the following logic:

a) IF A1+B1 is less than 10, then return 10

b) IF A1+B1 is greater than 10 but less than or equal to 20, then return 20

c) IF A1+B1 is greater than 20 but less than or equal to 30, then return 30.

d) IF A1+B1 is greater than 30, then return 200.

Let’s write the following nested IF formula in the cell C1:

=IF(A1+B1<10,10, IF(A1+B1<=20,20, IF(A1+B1<=30,30,200)))

google sheets nested if function1

The above formula just use basic nested IF function syntax, we also can use logic function to re-write it, the nested if formula with AND function is as follows:

=IF((A1+B1)<10,10,IF(AND((A1+B1)>10,(A1+B1)<=20),20, IF(AND((A1+B1)>20,(A1+B1)<=30),30,200)))

google sheets nested if function1

The above nested IF formula combined with two AND function.

In the second IF Statement, AND((A1+B1)>10,(A1+B1)<=20) will check if 10<A1+B1<=20, If TRUE, then the formula will return 20.

In the third IF Statement, AND((A1+B1)>20,(A1+B1)<=30) will check if 20<A1+B1<=30, If TRUE, then the formula will return 30.

Example 7# Google Sheets Nested IF function with logical function –OR

Assuming that you need a nested if function to reflect the following logic:

a) IF Cell A1=5, return A1/B1

b) IF Cell A1=10, return A2/B2

c) IF Cell A1=15 or A1=20, return A3/B3

In Cell C1, we can write the below nested if formula based on the above conditions.

=IF(A1=5,A1/B1,IF(A1=10,A2/B2,IF(OR(A1=15,A1=20),A3/B3)))

google sheets nested if function1

One OR function be used in the above excel nested if function, it will check if A1=15 or A1=20, if TRUE, then return A3/B3.

Example 8#  Google Sheets nested if function with text and logical function AND

Wrote a nested if function with text to reflect the following logic:

a) If Cell A1=”E” and Cell B1=5, then return “Excel”

b) If Cell A1=”P” and Cell B1=3, then return “PPT”

c) If Cell A1=”W” and Cell B1=4, then return “Word”

d) Else return “Access”

In Cell C1, try to enter into the following excel nested If formula with AND function:

=IF(AND(A1="E",B1=5),"Excel", IF(AND(A1="P",B1=3),"PPT", IF(AND(A1="W",B1=4),"Word","Access")))

google sheets nested if function1

Example 9#  Google Sheets nested if function with ISBLANK function and logical function AND

a) If you want to wrote a nested if function with ISBLANK function and logical function AND to reflect the following logic:

b) If both Cell A1 and Cell B1 are empty, then return “”

c) If only Cell A1 is empty, then return B1-today()

d) If both two cells A1 and B1 are not empty, then return “excel” string.

In Cell C1, use the following excel nested If formula with ISBLANK and AND function:

=IF(AND(ISBLANK(A1),ISBLANK(B1)),"",IF(ISBLANK(A1),B1-TODAY(),"excel"))

google sheets nested if function1

Example 10#  Using nested IF functions to check grade level based on student’s score(multiple IF statements)

The logic is as below:

Scores Grade
<50 Fail
51 to 60 Grade C
61 to 80 Grade B
81 to 95 Grade A
96 to 100 Grade A+

We will write a nested If function that reflect the above logic, and will check if the score is below 50, If TRUE, it is considered as “Fail”. If FALSE, move into the next IF statement to test if the score is between 51 and 60 and it is considered as “Grade C”. If False, we will move into another IF statement to check if the score is between 61 and 80, IF True and it is considered as “Grade B”. If FASLSE, just check the rest conditions.

We can use a nested if formula as follows:

=IF(B2<=50,"Fail",IF(AND(B2>=51, B2<=60), "Grade C", IF(AND(B2>=61, B2<=80),"Grade B",IF(AND(B2>=81,B2<=95),"Grade A", "Grade A+"))))

google sheets nested if function1

Example 11#  Nested IF function for checking two Empty Cells

Let’s see the below image a product table of a company (need to create a Google sheets table firstly):

a) If we need to check both “Price” cell and “Quantity” cell are empty, If True, then return empty. If the only “price” cell is empty only, IF True, return empty.

b) If the only “Quantity” cell is empty, IF True, return empty.

c) If both “price” and “Quantity” are not empty, then return multiply Price * Quantity as subtotal value.

So To check both “Price” and Quantity cells, we can use table header name as condition variable to test each Price cells or Quantity cells, so we can write the nested if formula as follows:

=IF([Price]="","",IF([Quantity]="","",[Price]*[Quantity]))

Just using the above Google sheets if formula in the subtotal cells, the formula will check the first IF statement if Price Cell is empty, IF TRUE, then will return empty (“”) in the subtotal cell. IF FALSE, then move to the next IF statement and so on. Last, IF neither cell is empty, then will return the value of multiply [Price]*[Quantity] in subtotal cell.

Of course, we can use another nested if function to achieve the above calculation logic (easy to understand).

=IF(ISBLANK(B2),"",IF(ISBLANK(C2),"", B2*C2))

OR

=IF(B2="","",IF(C2="","", B2*C2))

Nested IF Functions Order

There is one important thing that need us keep in mind when write Google sheets Nested IF Function, it is the order of nested IF function. It can nested up to 64 If statements, and how to order multiple IF condition statements, it is key point. Or the wrong result will be returned. The point is that Google sheets nested if function will test the first if condition in the order, once any condition is met, and the subsequent if conditions will not be checked.

So let’s remember the below rules while writing Google sheets nested if function:

  • The most important condition First or Harder Test First

Let’s see the below example what it means:

Example 12#

There are two test conditions in the following Google sheets nested if function:

=IF(B1>=90,"excellent",IF(B1>=60,"good","bad"))

google sheets nested if function1

When using this formula in the cell B3, If the amount in cell B1 is 95, then “excellent” would be returned. because it is greater than 90. And the second IF condition will not be evaluated.

However, if the order of nested if statment are reversed as follows:

=IF(B1>=60,”good”,IF(B1>=90,”excellent”,”bad”))

google sheets nested if function1

The above formula would check for the condition B1>=60 first, if the amount in cell B1 is 95,  then the value “good” would be returned in cell B3. Because the Cell B1 match the first test condition, and it will not check the second if condition and will return the incorrect result.

Nested IF Function Alternatives

To make your google sheets formulas more efficiency and fast, you can try to use the following alternatives to google sheets nested if function.


1)
google sheets nested if function can be easily replaced with the VLOOUP, Lookup, INDEX/MATCH or CHOOSE functions.

Example 13#  Use VLookup function instead of nested IF function

Nested IF function:

=IF(D1=39,"excelhow.net", IF(D1=45,"two",IF(D1=34,"google.com","")))

google sheets nested if function1

Vlookup function:

=VLOOKUP(39,A1:B3,2,FALSE)

google sheets nested if function1

Example 14#  Use CHOOSE function instead of nested if function

Nested If unction:

=IF(B1>=60,"good","bad")

google sheets nested if function1

Using CHOOSE function as follows:

=CHOOSE(IF(B1<60,1,2),"bad","good")

google sheets nested if function1

2) Use IFS instead of nested if function

3) Use the CONCATENATE function or the concatenate operator (&).

Example 15#

Nested IF function:

=IF(B1=”A”,”excellent”,IF(B1=”B”,”good”,”bad”))

google sheets nested if function1

Questions & Asked

Question1: Is there any tool to help write Google Sheets formulas and nested Ifs?

This is a Google Sheets formula with nested IF statements:

=IF((B2="East"),4,IF((B2="West"),3,IF((B2="North"),2,IF((B2="South"),1,""))))

To essentially accomplish this:

If cell B2 = "East"
   return "4"
ElseIf cell B2 = "West"
   return "3"
ElseIf cell B2 = "North"
   return "2"
ElseIf cell B2 = "South"
   return "1"
Else
   return ""

Can Google Sheets formulas be written in such a “more readable” manner and converted to the official syntax? Is there any tool to help write Google Sheets formulas?

Answer:  Google Sheets Formula Formatter add-in by Rob van Gelder, mentioned at Daily Dose of Google Sheets.

Google Sheets formula bar ignores line feeds and white space, so you can Alt+Enter and spacebar to format the formulas however you like. I’ve tried it and I quickly stopped doing it. Too much spacebar-ing, especially if you need to edit.

Question2: I am working on a Google Sheets file, and i am trying to use a nested if formula to achieve what i would like.

i have two columns:A B.  And the condition is this: if the value in a2=a3, then check if the minus of b2 and b3 is certain value, and if it is, put a yes, else put a no. this will iterate till the end of the Google Sheets file.

so far here is what i have. not sure how to use the Google Sheets formulas. any help is much appreciated.

if(a2=a3,b2-b3=5 or b2-b3=-5 or b2-b3=20 or b2-b3=-20, "yes", "no")

Answer: you should be able to use the OR function within your nested if formula to test for “B2-B3=5,B2-B3=-5,B2-B3=20,B2-B3=-20” as follows:

=IF(A2=A3,IF(OR(B2-B3=5,B2-B3=-5,B2-B3=20,B2-B3=-20),"yes","no"),"no")

Related Functions

  • Google Sheets ISBLANK function
    The Google Sheets ISBLANK function returns TRUE if the value is blank or null.The syntax of the ISBLANK function is as below:= ISBLANK (value)…
  • Google Sheets COUNTIF function
    The Google Sheets CHOOSE function returns a value from a list of values based on index. The syntax of the CHOOSE function is as below:=CHOOSE (index_num, value1,[value2],…) …
  • Google Sheets VLOOKUP Function
    The Google Sheets VLOOKUP function lookup a value in the first column of the table and return the value in the same row based on index_num position..The syntax of the VLOOKUP function is as below:= VLOOKUP (lookup_value, table_array, column_index_num,[range_lookup])…
  • Google Sheets IF function
    The Google Sheets IF function perform a logical test to return one value if the condition is TRUE and return another value if the condition is FALSE. The IF function is a build-in function in Microsoft Excel and it is categorized as a Logical Function.The syntax of the IF function is as below:= IF (condition, [true_value], [false_value])….
  • Google Sheets Choose function
    The Google Sheets CHOOSE function returns a value from a list of values based on index.The syntax of the CHOOSE function is as below:=CHOOSE (index_num, value1,[value2],…)….

Google Sheets IF Function

This post will guide you how to use Google Sheets IF function with syntax and examples in Google Spreadsheets.

Description

The Google Sheets IF function perform a logical test to return one value if the condition is TRUE and return another value if the condition is FALSE.

The IF function is a build-in function in Google Spreadsheets and it is categorized as a Logical Function.

Syntax

The syntax of the IF function is as below:

= IF (condition, [true_value], [false_value])

Where the IF function arguments are:

  • Condition -This is a required argument.  A user-defined condition that is to be tested.
  • True_value – This is an optional argument.  The value that is returned if condition evaluates to TRUE.
  • False_value – This is an optional argument.  The value that is returned if condition evaluates to FALSE.

The below examples will show you how to use Google Sheets IF Function to return one value if the condition is TRUE or FALSE.

=IF(B1>90, "good", "bad")

google sheets IF function1

Note: the above Google Sheets formula will test a condition “b1>90”, if the condition is true, then “good” will return or “bad” will return.

Nested IF statements

The Google Sheets IF function just only test one condition and if you want to deal with more than one condition and return different actions depending on the result of the tests,  then you need to include several IF statements (functions) in one Google Sheets IF formula, these multiple IF statements are also called Google Sheets Nested IF formula(Nested IFs).

For example:

=IF(A1>=80, "excellent", IF(A1>=60, "good", IF(A1>0, "bad", "no valid score")))

More reading:  Google Sheets Nexted IF Functions (Statements) Tutorial

Google Sheets Logical operators

When you are writing an If statement, you may need to use any of the following Google Sheets logical operators:

Operator Meaning Example Description
= Equal To A1=B1 Returns True if a value in cell A1 is equal to the values in cell B1; FALSE if they are not.
> Greater Than A1>B1 Returns True if a value in cell A1 is greater than the values in cell B1; FALSE if they are not.
>= Greater Than or Equal to A1>=B1 Returns True if a value in cell A1 is greater than or equal to the values in cell B1; FALSE if they are not.
< Less Than A1<B1 Returns True if a value in cell A1 is less than the values in cell B1; FALSE if they are not.
<= Less Than or Equal to A1<=B1 Returns True if a value in cell A1 is less than or equal to the values in cell B1; FALSE if they are not.
<> Not Equal to A1<>B1 Returns True if a value in cell A1 is not equal to the values in cell B1; FALSE if they are not.

 

Let’s see some examples for logical operators in Google Sheets formula:

A1 B1
8 5
  =(A1>B1)  //Output: TRUE 

=(A1<B1) //Output: FALSE 

=(A1>=B1) //Output: TRUE 

=(A1<>8) //Output: FALSE

 =(A1<>B1) //Output: TRUE

 =(IF A1>3, “TRUE”, “FALSE”) //Output: TRUE

Frequently Asked Questions

Question1: I want to write an IF Formula based on the below test criteria in the Google Spreadsheets.

If the number in Cell B1 is greater than 30, then I want it to return A

If the number in cell B1 is between 20 and 30, then I want it to return B

If the number in Cell B1 is below 20, then I want it to return C

The below formula is what I currently write:

=IF(B1>30,"A",IF(B1<30,B1>20,"B","C"))

When I entered the above formula in the Cell C1, and it will return an Error.

Answer:  You can use IF function in combination with AND function to reflect the above logic. So you can do it using the following formula:

=IF(B1>30,"A",IF(AND(B1>=20,B1<=30),"B","C"))

Or you can use another IF formula without AND function as follows:

=IF(B1>30,"A",IF(B1<20,"C","B"))

 

Question 2: I want to write a Google Sheets Formula for sales rep, If the sales are less than 10K, then the member will get no commission. If the sales are between 10 and 50K, then the member will get a 3% commission. If the sales are more than 50k, then the member will get 5% commission. Could you help me?

Answer: Based on the above description, we can use the following Google Sheets IF formula:

=IF(B1<10,0,IF(B1<50,B1*3%,B1*5%))

 

Question 3: I want to select students for the scholarship in school, and based on the student’s scores and attendance value, if the student scores more than 85 and has the attendance of more than 85%, then he/she will get the scholarship. Please help me how to write this formula based on my test criteria.

Answer: you can use the IF function with the AND function to check whether both of two conditions are met or not. If the test are met, then return “Yes”, otherwise returns “No”.

So you can use the following IF formula in Google Sheets:

=IF(AND(B1>85, C1>85%),"Yes","No")

 

Question 4:  I am trying to write an Google Sheets formula based on the following logic:

I want to enter a formula in Cell C1 that will Add B1, B2 and B3 or multiply B1 by 1, multiply B2 by 2, multiply B2 by 3, which action will be taken based on what you put in Cell D1.

Appreciated for any help. Thanks

Answer: Based on the above logic description, you need to use SUM function to count the sum of B1, B2 and B3. We can use the following IF formula:

=IF(D1="Add”,SUM(B1,B2,B3),IF(D1="Multiply",B1*B2*B3,"ERROR"))

 

Question 5:  I am trying to write a formula in Google Sheets to check the employee number field and returns the relevant band of employee. I already have one IF formula, but I always return the first value of “A”. Could you help?

=IF(B1>=10,"A",IF(B1>=20,"B",IF(B1>=50,"C")))

Answer:  when you write an IF nested formula, you need to start with the largest number first or start the smallest number first with less than or equal to operator.

1# start with the largest number first, we can write down the below formula:

=IF(B1>=50,"C",IF(B1>=20,"B",IF(B1>=10,"A")))

2# start with the smallest number first, you need to change the >= to <= , just see the below formula:

=IF(B1<=10,"A",IF(B1<=20,"B",IF(B1<=50,"C")))

 

Question 6: I want to write a Formula in Google Sheets to return “bad” if the cell B1 is either <100 or >500, otherwise, it should be returned the value of cell B1.

Answer: For the above logic test, we should use the OR function in the IF condition, so we can write down the below IF formula:

=IF(OR(B1>500,B1<100),"good",B1)

 

Question 7: I want to write a formula in Google Sheets using IF function to check if the cell B1 >10 and B1<20. If TRUE, returns “good”, If FALSE, returns “bad”

Answer: You can use IF function in combination with AND function to check the value of Cell B1, if cell B1 is greater than 10 and cell B1 is less than 20, then returns “good”, otherwise, it will return “bad”.

=IF(AND(B1>10,B1<20),"good","bad")

 

Question 8:  I need to write a nested IF statement in Google Sheets to check the following logic:

If Cell B1 is less than 5, then multiply it by 5.

If Cell B1 is greater than or equal to 5 but less than 10, then multiply it by 10.

If cell B1 is greater than 10, then multiply it by 15.

Answer: This is a generic nested IF formula in Google Sheets, we can write the below nested IF statement to reflect the logic.

=IF(B1<5, B1*5, IF(B1<10, B1*10, B1*15))

 

Question 9:  I want to write a formula to match the following logic in Google Sheets:

If A1*B1 <=10, then returns A

If A1*B1 >10 but A1*B1 <=20, then returns B

If A1*B1 >20 but A1*B1 <=30, then returns C

If A1*B1>30, then returns D

Answer: You can use IF function to build a Nested IF statement in combination with AND function to achieve it. Let’s write down the following IF formula:

=IF(A1*B1<=10,"A", IF(AND(A1*B1>10,A1*B1<=20),"B", IF(AND(A1*B1>20,a1*B1<=30,"C","D"))))

 

Question 10: I want to write an IF function to check if the value in cell B1 is blank or Text string or Numeric value, if the cell B1 is empty, then return “blank”, if the cell B1 is a text string, then return “Text”, if the value in cell B1 is a numeric value, then return “number”. Any help for this formula, thanks.

Answer: Based on the description, you need to use ISBLANK function to check if the value in cell b1 is blank or not. And need to use ISTEXT function to check if the value in cell B1 is a text string or not and need to use ISNUMBER function to check if the value in cell B1 is a number or not. So you can write a nested IF statements in combination with ISBLANK, ISTEXT and ISNUMBER functions in Google Sheets as follows:

=IF(ISBLANK(B1),"blank", IF(ISTEXT(B1),"Text", IF(ISNUMBER(B1),"number")))

 

Question 11:  I want to write a formula in Google Sheets to calculate the bonus for employees in company, if the employee salary is greater than or equal to $2000, then the bonus will be 10% of the salary , otherwise, the bonus will be 5% of the employee salary.

Answer:  we need to check if the salary in Cell B1 (it’s the salary of the first employee) is greater than or equal to 2000. It the condition test is TRUE, then returns B1*10%, otherwise returns b1*5%. So we can write down the following IF formula in Google Sheets:

=IF(B1>=2000, B1*10%, B1*5%)

 

Question 12: In Google Spreadsheets, I want to create an IF function to check if any employee who have at least 10 years of experience and whose salary is greater than $5000, If TRUE, then the bonus will be 20% of salary.

Answer: you can use IF function in combination with AND function to check if the value in cell B1 is greater than or equal to 10 and the value in Cell C1 is greater than 5000. If both of two conditions are TRUE, then returns C1*20%, otherwise returns “No Bonus”.

Let’s write down the following IF statement as follows:

=IF(AND(B1>=10,C1>5000),C1*20%, "No Bonus")

 

Question 13: I want to create an IF formula in Google Sheets to check the following text logic:

If B1<10, then multiply B1 by 1%, but the returned value is not less than 50.

If B1>10, then multiply B1 by 2%, but the returned value is not greater than 100.

Answer: To reflect the first test condition, you need to use MAX function to match the condition. To reflect the second test condition, you need to use MIN function to match that the returned value should not be greater than 100. So we can use the following Google Sheets IF formula:

=IF(B1<10, MAX(50,B1*1%), IF(B1>10, MIN(100,B1*5%)))

 

Question 14:  I want to use IF function to check if B1 is greater than 10 and B2 is greater than 20 and B3 is less than 30, if TRUE, then returns “good”, otherwise, it should be returned “bad”.  So How to create the IF formula based on the above test criteria to check three conditions at the same time.

Answer: you need to use AND function within the IF function in Google Sheets to create an IF formula as follows:

=IF(AND(B1>10,B2>20,B3<30),"good","bad")

 

Question 15:  I have an IF formula that might cause a division by zero error, I don’t know how to avoid this kind of errors in Google Sheets formula.

Answer: You can use ISERROR function to catch this kind of errors then use the IF function to check the returned values from ISERROR function to avoid an error. So we can write an IF function in combination with ISERROR function in Google Sheets. For example, we can use the following IF formula:

=IF(ISERROR(B1/C1),0, B1/C1)

The ISERROR function will return TRUE when trying to divide B1 by 0.

 

Question 16:  I need to create a formula in Google Sheets to reflect the following logic:

If B1=Google, then return E

If B1=sheets, then return W

If B1=info, then return A

Answer:  You can use IF function to create a nested IF statements as follows:

=IF(B1=" Google ","G",IF(B1=" sheets ","S",IF(B1=" info ","I")))

 

Question 17:  I have a worksheet that containing cells that are formatted as date format. I want to write an IF formula to check the first value in Cell (month part). So I am trying to create the following IF formula:

=IF(LEFT(B1,1)=8, "August","Null")

The returned results are always “Null”.

Answer: As the dates are not recognized as string, so you cannot use the LEFT function to exact the first value in the dates. At this moment, you need to use Month function to convert the date to its month number in Google Sheets. So we can write down the below IF formula in combination with Month function:

=IF(MONTH(B1)=8, "August","Null")

 

Question18: I am trying to create an IF formula to check if the time value in cells are greater than 10.00h for the following date format: 08/11/2018 09:43.50.  Appreciative of any help.

Answer: In Google Sheets, you can use HOUR, MINUTE, SECOND functions to compare the date or time value. so if you want to compare the value in Cell B1 if it is greater than 10h, then you can use HOUR function within IF function, just like this: HOUR(B1)>10, so we can write down the below formula:

=IF(HOUR(B1)>10, "greater","less")

 

Question 19: I want to create an IF function and need to combine with another RAND function.  The formula just works find for the first IF_VALUE_TRUE statement, but the formula works not good for IF_VALUE_FALSE statement. Here is the IF formula I have got:

=IF(ISBLANK(B1),"","=rand()")

In the above IF function, it will return empty string when the value in cell B1 is blank. Otherwise, it should add a random function, the problem is that the cell doesn’t run the RAND function. So how can I fix it?  Thanks

Answer:  when you write an IF formula, if you want to enclose others function, you need not to add quotes around the RAND () function, so just remove the quotes and equal sign in your IF function. Just like the below IF formula:

=IF(ISBLANK(B1),"",RAND())

 

Question 20: I am trying to write an IF formula in Google Sheets to reflect the following logic:

If B1 is greater than or equal to 50 and C1 is 0

OR

If B1 is greater than or equal to 30 and C1 is greater than or equal to 1

OR

If B1 is greater than or equal to 20 and C1 is 2

Then take the following action:  D2/E2

Otherwise, return FALSE

I have wrote the following IF formula, but it doesn’t work at all.

=IF(AND(B1>=50,C1>=0),OR(AND(B1>=30,C1>=1)),OR(AND(B1>=20,C1>=2)),D2/E2,"FALSE")

Answer: you need to nest your different AND function within an OR function in the IF formula. So you can try the below IF formula:

=IF(OR(AND(B1>=50,C1>=0),AND(B1>=30,C1>=1),AND(B1>=20,C1>=2)), D2/E2,"FALSE")

 

Question 21: I want to create an IF function in combination with MID function in Google Sheets. it need to check if the value in one specified cell is TRUE, then return the first six characters from another cell. Otherwise return empty value.

Answer: you just need to add MID function within IF function in Google Sheets, and do not add any quotes around MID function.    So you can use the following IF formula to achieve your request:

=IF(B1=TRUE, MID(C1,1,5), "")

 

Question 22:  I have a Google Sheets as below:

A     B

——

20   O

30   V

10   T

50   T

I want to create an IF formula to reflect the following logic:

IF cell A1 is less than or equal to 30 and Cell B1 is equal to “O” or “V”, if TRUE, then returns 300, otherwise returns 400.

IF Cell A1 is greater than 30 and Cell B1 is equal to “O” or “V”, then returns 500, otherwise returns 600.

I have wrote the below tow IF formulas for the above two conditions as follows:

=IF(AND(A1<=30,OR(B1="O",B1="V")),300,400)

=IF(AND(A1>30,OR(B1="O",B1="V")),500,600)

I am able to check the above two IF formula and the returned results is OK… But I am not able to combine the above two IF formula into a single IF formula. So anybody can help? Many thanks

Answer:  Based on the above logic, you can use the below IF formula to combine with above two IF formulas:

=IF(A1<=30,IF(OR(B1="O",B1="V"),300,400),IF(OR(B1="O",B1="V"),500,600))

 

Question 23: I am trying to write an IF function to prevent zero and negative values in cells. What I would like is that if the value in cell B1 is less than or equal to 0, then it should be returned “Null” otherwise, it should return the calculation of Cells value, like as:B2*(C2-D2)*E2.

The below IF formula is what I have:

=IF(B1<=0,"Null","B2*(C2-D2)*E2")

When I run the formula above, it only returns my calculation string and do not take the actual calculation.

Answer: In Google Sheets, the double quotes make any values in between be recognized as Text string. So if you want to take calculation for your IF formula, just remove the double quotes.  Let’s see the modified IF formula as follows:

=IF(B1<=0,"Null",B2*(C2-D2)*E2)

 

Question 24: I want to create an new IF function to check if the value in cells is Saturday or Sunday, If TRUE, returns “yes”, otherwise, returns “No”. And I am using the following IF formula, but I get an error, so what’s wrong for this formula?

=IF((OR($B1="Saturday","$B1="Sunday"),"yes","no"))

Answer: you need to use the WEEKDAY function within IF function to handle the dates if they are in date format, like as: 11/8/2018.

So you can use the below IF function to achieve your logic:

=IF(WEEKDAY($B$1,2)>5,"yes","no")

You can also use TEXT function within the IF function to achieve the same results, just like the below IF formula:

=IF(LEFT(TEXT($B$1,"ddd"))="S","yes","no")

 

Question 25: I want to write an IF function in Google Sheets to check if the first character in one Cell is equal to 5, then the returned value should be the five rightmost characters of that cell, otherwise, the returned value should be the four rightmost characters. I wrote one IF formula as follows, but it doesn’t work.

=IF(LEFT(B1,1)=5, RIGHT(B1,5),RIGHT(B1,4))

In the above IF function, it always return the rightmost four characters even though the first character in Cell B1 starts with “S”.  Please help me to fix it.

Answer: you should know the returned value of the LEFT function firstly in Google Sheets. As the LEFT function will return a Text value, so you also need to provide a string for comparison, so adding quotes to enclose it. Just like the below IF function:

=IF(LEFT(B1,1)="5", RIGHT(B1,5),RIGHT(B1,4))

There is another way to achieve the same results, you can use NUMBERVALUE function to convert the result of LEFT function to a numeric value, like the below IF function:

=IF(NUMBERVALUE(LEFT(B1,1))=5,RIGHT(B1,5),RIGHT(B1,4))

 

Question 26:  I have 2 columns contain date and time or just only contain time. And I want to check if the times of column A is greater than the times of column B. the key issue may be that column A has the date and time.  I wrote the following IF formula to run it in Cell C1, but it returned the inaccurate results.

=IF(A1>B1,"yes","no")

Any help would be appreciated… Many thanks!

Answer:  the date part of the value in column A is the integer, while the time is the decimal. You can use the following IF formula:

=IF(A1-INT(A1)>B2),"yes","no")

 

Question 27:  The below are the results that I expected, and I want cell B1 to B4 can detect the string from A1 to A4 automatically and return the same string value plus the severity level when the test match. For example, If A1 is equal to “critical”, then it should be returned “critical severity 1” in the cell B1. Etc.

And I am using the following IF formula, but it does not work at all. Please help to fix it. Thanks

=IF(A1="Critical","Critical Severity 1",""),IF(A1="High","High Severity 2",""),IF(A1="Medium","Medium Severity 3",""),IF(A1="Low","Low Severity 4","")

 

A B
critical  critical severity 1
high high severity 2
medium Medium severity 3
low low severity 4

 

Answer: you can try to run the following IF formula in Google Sheets:

=IF(A1="critical","critical Severity 1",IF(A1="high","high Severity 2",IF(A1="medium","medium Severity 3",IF(A1="low","low Severity 4",""))))

 

Question 28: I am working on a Google Sheets file and want to create a new IF formula to reflect the following logic:

If the value in Cell A1 is equal to the value in Cell A2, then check if the minus of B1 and B2 is equal to a special value, and if the condition is TRUE, returns “yes”, otherwise, returns “no”.  Here is the IF formula I have:

=if(A1=A2,B1-B2=5 or B1-B2=-5 or B1-B2=20 or B1-B2=-20, "yes", "no")

Any help is appreciated…Thanks

Answer: you need to use OR function with IF function to create a nested IF statement to achieve your request. So you can try the following Google Sheets IF formula in your Google Sheets file.

=IF(A1=A2,IF(OR(B1-B2=5,B1-B2=-5,B1-B2=20,B1-B2=-20),"yes","no"),"no")

 

Question 29: I want to create an IF formula to check the range of cells in Google Sheets.  I have scores of different subject for a student, and want to check if any one of scores is less than 60, If TRUE, then return “BAD”.  Can this logic be done with the IF statements in Google Sheets?

Answer: you can use COUNTIF function within IF function to create a generic IF formula as follows:

=IF(COUNTIF(B:B,"<60")>0,"BAD","Good")

 

Question 30: I am trying to create a new IF statement so that when the formula is looking at Row A and Row B, the returned values should be shown in the Row C. the following logic need to be checked:

IF the value in the Row A is equal to “NA” And the value in the Row B is equal to “NA”, then return “NA” value in Row C.

IF the value in the Row A is equal to “NA”, and the value in the Row B is equal to “denied”, then return “denied” value in Row C.

IF the value in the Row A is equal to “allowed” and the value in the Row B is equal to “NA”, then return “allowed” value in Row C.

Here is my formula:

=IF(AND(A1 = "NA", B1 = "NA"),"NA",IF(OR(A1="denied",B1 ="denied"),"denied", "NA"))

I don’t know how to include “allowed” in the IF formula above, anyone can help this, many thanks.

Answer: This is a typical nested if statement, you can use OR function within IF function in Google Sheets. We can write down this nested IF formula as follows:

=IF(OR(A1="denied", B1="denied"), "denied", IF(OR(A1="allowed", B1="allowed"), "allowed", "NA"))

Related Functions

  • Google Sheets ISBLANK function
    The Google Sheets ISBLANK function returns TRUE if the value is blank or null.The syntax of the ISBLANK function is as below:= ISBLANK (value)…
  • Google Sheets COUNTIF function
    The Google Sheets CHOOSE function returns a value from a list of values based on index. The syntax of the CHOOSE function is as below:=CHOOSE (index_num, value1,[value2],…) …
  • Google Sheets IF function
    The Google Sheets IF function perform a logical test to return one value if the condition is TRUE and return another value if the condition is FALSE. The IF function is a build-in function in Microsoft Excel and it is categorized as a Logical Function.The syntax of the IF function is as below:= IF (condition, [true_value], [false_value])….
  • Google Sheets LEFT function
    The Google Sheets LEFT function returns a substring (a specified number of the characters) from a text string, starting from the leftmost character.The syntax of the LEFT function is as below:= LEFT(text,[num_chars])….
  • Google Sheets MID Function
    The Google Sheets MID function returns a substring (a specified number of the characters) starting from the middle of a text string. The syntax of the MID function is as below:= MID (text, start_num, num_chars)…
  • Google Sheets RIGHT Function
    The Google Sheets RIGHT function returns a substring (a specified number of the characters) from a text string, starting from the rightmost character.The syntax of the RIGHT function is as below:=RIGHT(text,[num_chars])…

Google Sheets ISBLANK Function

This post will guide you how to use Google Sheets ISBLANK function with syntax and examples in Google Spreadsheets.

Description

The Google Sheets ISBLANK function returns TRUE if the value is blank or null.

The ISBLANK function is a build-in function in Google Sheets and it is categorized as an Information Function.

Syntax

The syntax of the ISBLANK function is as below:

= ISBLANK (value)

Where the ISBLANK function argument is:

  • Value -This is a required argument. The value that you want to test.

Google Sheets ISBLANK Function Examples

The below examples will show you how to use Google Sheets ISBLANK Function to test if the value is blank, if so, return TRUE.

#1 = ISBLANK (B2)

google sheets ISBLANK function1

See Also: Check If a Cell is Blank or Empty in Google Sheets

Check If a Cell is Blank or Empty in Google Sheets

The article demonstrates how to check if a range of cells is blank or empty by ISBLANK and other functions to recognize empty cells in Google Spreadsheets and take appropriate action based on their status.

There are several circumstances in which you need to determine if a cell is empty or not. If a cell is blank, for example, you may want to add, count, copy a value from another cell, or do nothing. ISBLANK is the appropriate function to employ in these situations, occasionally alone, but most often in conjunction with other Google Sheets functions.

ISBLANK in Google Sheets – a few points to keep in mind

The critical item to remember is that the ISBLANK function in Google Sheets recognizes actually empty cells, that is, cells that contain nothing: no spaces, no tabs, no carriage returns, or anything else that looks blank in a view.

ISBLANK returns FALSE for a cell that seems to be blank but is not. If a cell includes any of the following, this behavior occurs:

=IF(A1>"", A1, "") //yields an empty string

check if a range of cells is blank or empty in google sheets1

Imported zero-length string from an external database or as a consequence of a copy/paste operation.

Spaces, apostrophes, non-breaking spaces (&nbsp);, linefeeds, and other non-printing characters are permitted.

How to utilize the ISBLANK function in Google Sheets

To obtain a better grasp of the ISBLANK function‘s capabilities, consider these practical applications.

If a cell is blank in Google Sheets, then

Because Google Spreadsheets does not have an IFBLANK function, you must use IF and ISBLANK to test a cell and execute an action if it is empty.

The general version is as follows:

=IF(ISBLANK(B1), "open", "completed")

check if a range of cells is blank or empty in google sheets1

To demonstrate, let’s verify whether a cell in column B (delivery date) has any data. If the cell is empty, output “Open”; if it is not empty, produce “Completed”.

Please keep in mind that the ISBLANK function only returns cells that are completely blank. ISBLANK returns FALSE if a cell contains anything invisible to the human eye, such as a zero-length string.

If any cell in range is blank, then do something

There are many techniques to check a range of cells in Google Sheets for empty cells. We will use an IF statement to output one value if the range has at least one empty cell and another value if the range contains no empty cells. The logical test is performed by calculating the total number of empty cells in the range and then determining if the count is larger than zero. This may be accomplished via the use of  COUNTIF function.

Related Functions

  • Google Sheets ISBLANK function
    The Google Sheets ISBLANK function returns TRUE if the value is blank or null.The syntax of the ISBLANK function is as below:= ISBLANK (value)…
  • Google Sheets IF function
    The Google Sheets IF function perform a logical test to return one value if the condition is TRUE and return another value if the condition is FALSE. The IF function is a build-in function in Microsoft Excel and it is categorized as a Logical Function.The syntax of the IF function is as below:= IF (condition, [true_value], [false_value])….
  • Google Sheets COUNTIF function
    The Google Sheets CHOOSE function returns a value from a list of values based on index. The syntax of the CHOOSE function is as below:=CHOOSE (index_num, value1,[value2],…) …