Formula for Blank Cell

tbones

New Member
Joined
Jul 18, 2008
Messages
43
Office Version
  1. 365
Platform
  1. Windows
On the link here: Outcome C2 is decided by the values in A2 and B2. So if A2 is greater than B2 then it puts in a H in C2. If A2 and B2 are the same then it puts in D.if A2 is less than B2 then it puts in A . I am also asking it that if A2 or B2 is blank then it should leave C2 blank as well.
The formula I have put in does not seem to work so I am not sure what I am doing wrong. It will not leave the cell blank if there are not any values in A2 and B2 .
This the formulas I am using
=IF(A2>B2,"H",IF(A2=B2,"D",IF(A2>B2,"A","")))
Any Ideas what I am doing wrong?
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Book1
ABC
1
221H
312A
411D
5 
Sheet1
Cell Formulas
RangeFormula
C2:C5C2=IF(OR(A2="",B2=""),"",IF(A2>B2,"H",IF(A2=B2,"D",IF(A2<B2,"A"))))
 
Upvote 0
Another way

23 06 24.xlsm
ABC
1
221H
312A
411D
54 
6 
73 
tbones
Cell Formulas
RangeFormula
C2:C7C2=IF(COUNT(A2:B2)=2,MID("ADH",SIGN(A2-B2)+2,1),"")
 
Upvote 0
Solution
Thank you both. I tried your one Kevin however it did not leave the cell blank if the other cells were blank. I also tried Peters one and that did the trick.
Thanks for the help
 
Upvote 0
You're welcome. Glad we could help. Thanks for the follow-up. :)

BTW, Kevin's formula works for me as shown below. If it does not work for you then it would seem those blank cells are not actually blank. Perhaps they contain a space character?

23 06 24.xlsm
ABC
1
221H
312A
411D
54 
6 
73 
tbones (2)
Cell Formulas
RangeFormula
C2:C7C2=IF(OR(A2="",B2=""),"",IF(A2>B2,"H",IF(A2=B2,"D",IF(A2<B2,"A"))))
 
Upvote 0
You're welcome. Glad we could help. Thanks for the follow-up. :)

BTW, Kevin's formula works for me as shown below. If it does not work for you then it would seem those blank cells are not actually blank. Perhaps they contain a space character?

23 06 24.xlsm
ABC
1
221H
312A
411D
54 
6 
73 
tbones (2)
Cell Formulas
RangeFormula
C2:C7C2=IF(OR(A2="",B2=""),"",IF(A2>B2,"H",IF(A2=B2,"D",IF(A2<B2,"A"))))
maybe that was it then. I will go back and take a look. Thank you...
 
Upvote 0
Thank you both. I tried your one Kevin however it did not leave the cell blank if the other cells were blank. I also tried Peters one and that did the trick.
Thanks for the help
Apologies to Kevin, The one you gave works indeed. I did not leave the spaces blank as I put a space in each cell. Thank you once again that worked fine.
 
Upvote 0

Forum statistics

Threads
1,215,459
Messages
6,124,947
Members
449,198
Latest member
MhammadishaqKhan

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