nested IF formula

ADAMC

Well-known Member
Joined
Mar 20, 2007
Messages
1,169
Office Version
  1. 2013
Platform
  1. Windows
Hi all,

Can anyone help me with a formula for the following please?

If H1 isn't blank do nothing, if it is then G1, but if G1 AND H1 are blank show "error"

Thank you
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Hi all,

Can anyone help me with a formula for the following please?

If H1 isn't blank do nothing, if it is then G1, but if G1 AND H1 are blank show "error"

Thank you

When you say "If H1 isn't blank do nothing" do you mean to return the value on H1, or leave the formula return "" , or the formula to return the word "nothing"?
 
Upvote 0
When you say "If H1 isn't blank do nothing" do you mean to return the value on H1, or leave the formula return "" , or the formula to return the word "nothing"?




You can also use

=IF(H1<>"","",IF(AND(G1="",H1=""),"Error",G1)) - that will leave it blank if H1 isn`t blank or

=IF(H1<>"","Nothing",IF(AND(G1="",H1=""),"Error",G1)) - will return "Nothing" if H1 isn`t blank
 
Upvote 0
Thanks Sebyq,

You are correct I actually meant if H1 isn't blank then return H1
 
Upvote 0
Thanks Sebyq,

You are correct I actually meant if H1 isn't blank then return H1


in that case change "nothing" in the formula to H1 - like below.

So If H1 is not blank(has a value) return the value in H1, if G1 and H1 is blank than return "Error", if the first 2 are false then return the value of G1.

=IF(H1<>"","H1",IF(AND(G1="",H1=""),"Error",G1))


 
Upvote 0
What values do you have in H1 and G1, are they numbers or text?
 
Upvote 0
My Post #2 formula modified as per your requirement.

=IF(LEN(G1&H1),IF(H1="",G1,"H1"),"Error")
 
Upvote 0

Forum statistics

Threads
1,223,952
Messages
6,175,593
Members
452,654
Latest member
mememe101

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top