Excel Help

asksign

Board Regular
Joined
Mar 22, 2016
Messages
62
Hi,

I have an data as mentioned below, If the wanted is zero, then the cell should be empty else it should show the number.


[TABLE="width: 208"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD]Stock[/TD]
[TD]Available[/TD]
[TD]Wanted[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]5[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]5[/TD]
[TD]0[/TD]
[/TR]
</tbody>[/TABLE]


can any one help me in this.

Thanks in advance.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
.
First, consider the title to your thread. "Excel Help"

Now, consider that you are someone else doing a search of the Forum for code that will cause a cell to be blank if the cell contains the number zero.

How successful would your search be based on the title of your post ?

Everyone who posts or searches on this and other Excel Forums is seeking "Excel Help" in some form or fashion. Using that as the title of a post does not
provide for a successful search for others. Also consider that your post/s are meant not only to assist you, but also to assist others in the future.


Now, to the heart of your question ... here are two macros. One is driven by a command button and the other is automatic.


Command button driven (paste into a Routine Module) :

Code:
Sub ChangeTest()
    Dim LastRow As Long
    Dim i As Long
      LastRow = Range("G" & Rows.Count).End(xlUp).Row
      For i = 2 To LastRow
        Select Case Range("G" & i)
          Case 0
            Range("G" & i) = ""
        End Select
      Next i
End Sub


Automatic (Paste into the worksheet level module) :

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
 Dim LastRow As Long
    Dim i As Long
      LastRow = Range("G" & Rows.Count).End(xlUp).Row
      For i = 2 To LastRow
        Select Case Range("G" & i)
          Case 0
            Range("G" & i) = ""
        End Select
      Next i
End Sub
 
Upvote 0
Hello Sir,

Thanks for your kind advice, I am not so familiar in excel. Is there any simple way to get the results in excel via excel formula, other than Macros.

Please accept my apologies, If my question hurts you.
 
Upvote 0
.

To answer your question ... No.


Using formulas :

Let's say the cell where a Zero may appear is F3. Using formulas you can cause any other cell to be blank if there is a zero in F3, but you won't be able to make F3 itself blank.
 
Upvote 0
maybe it will do what you want:
- go to Options
- Advanced
- Display options for this workshet
- uncheck : show a zero in cells that have zero value
 
Upvote 0
Hi,

May be OP simply means this:


Book1
ABC
1StockAvailableWanted
2651
355
Sheet164
Cell Formulas
RangeFormula
C2=IF(A2-B2,A2-B2,"")


Formula copied down.
 
Upvote 0
Hi, I can see this works, but WHY does it work? On the face of it, it's just a calculation of the difference between the two cells, so what is the IF statement testing for True/False?
 
Upvote 0
For Excel's purposes, any non-zero number can be coerced to True, and 0 to False. So essentially the formula is a shorthand for:

=IF(A2-B2<>0,A2-B2,"")
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,207
Members
452,618
Latest member
Tam84

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