How to make cell Result as Blank, if one of sum of cells have no value

pankajgrover

Board Regular
Joined
Oct 27, 2022
Messages
99
Office Version
  1. 365
Platform
  1. Windows
How to make cell Result as Blank, if one of sum of cells have no value. In below example i want D3 and D4 should be result as blank until a3 and b4 have some values. Thanks
Shares Trading.xlsx
ABCD
1ItemABTotal
2pen250035001000
3pencil50005000
4rubber4000-4000
Sheet1
Cell Formulas
RangeFormula
D2:D4D2=C2-B2
 
It may not be possible with your worksheet but if any cell(s) had a non-numerical value that "blank" check may result in an error as in D3. Using COUNT, as in col E, would ensure that both cells were numbers before the subtraction was attempted.

The COUNT idea also makes it easier to extend if the number of cells involved is greater. For example, in the bottom section, I only want a total if all 6 cells in the row are filled with numbers.

22 12 25.xlsm
ABCDEFG
1ItemABTotalTotal
2pen2500350010001000
3pencilx5000#VALUE! 
4rubber4000  
5
6Total
731556 
847924430
COUNT
Cell Formulas
RangeFormula
D2:D4D2=IF(OR(B2="",C2=""),"",C2-B2)
E2:E4E2=IF(COUNT(B2:C2)=2,C2-B2,"")
G7:G8G7=IF(COUNT(A7:F7)=COLUMNS(A7:F7),SUM(A7:F7),"")
 
Upvote 0

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
It may not be possible with your worksheet but if any cell(s) had a non-numerical value that "blank" check may result in an error as in D3. Using COUNT, as in col E, would ensure that both cells were numbers before the subtraction was attempted.

The COUNT idea also makes it easier to extend if the number of cells involved is greater. For example, in the bottom section, I only want a total if all 6 cells in the row are filled with numbers.

22 12 25.xlsm
ABCDEFG
1ItemABTotalTotal
2pen2500350010001000
3pencilx5000#VALUE! 
4rubber4000  
5
6Total
731556 
847924430
COUNT
Cell Formulas
RangeFormula
D2:D4D2=IF(OR(B2="",C2=""),"",C2-B2)
E2:E4E2=IF(COUNT(B2:C2)=2,C2-B2,"")
G7:G8G7=IF(COUNT(A7:F7)=COLUMNS(A7:F7),SUM(A7:F7),"")
Thanks for reply. I also want to ask until B4 or C4 values did not come , i want to replace this values with suppose with G column temporary values until B4 or C4 values not come. how to do that ?
 
Upvote 0
I also want to ask until B4 or C4 values did not come , i want to replace this values with suppose with G column temporary values until B4 or C4 values not come. how to do that ?
I don't understand that. Can you show 6 to 8 sample dummy rows of data and the expected results with XL2BB?
 
Upvote 0
I don't understand that. Can you show 6 to 8 sample dummy rows of data and the expected results with XL2BB?
I little bit manage replace "" with another condition. Here actual example below i used this if and or formula in M column. if f or j column have no price then it will take price c column until actual i fill price in f or j column. But in this situation i face another issue M18 cell which gives wrong value due to -neg entry doing + . here result should be 3 instead of 863 ? how to fix that ?

Shares Trading (1).xlsx
ABCDEFHIJKMN
15Silver30.0069033.0022/12/2022169191.00Silver169750.001000.0055915770
16Silver30.0069033.00Silver164972.50-4061-121815
17Silver30.0069033.00Silver0.564845.00-4188-62820
18Natural Gas1250.00430.4022/12/20221433.00Natural Gas-863-3250
19     
hh
Cell Formulas
RangeFormula
B15:B19B15=IFERROR(VLOOKUP(A15,Prices!$A$2:$C$25,2,0),0)
C15:C19C15=IFERROR(VLOOKUP(A15,Prices!$A$2:$C$25,3,0),0)
H15:H19H15=hh!$A15
M15:M19M15=IF(OR(F15="",J15=""),J15-F15-C15,J15-F15)
N15:N19N15=(((E15-I15)*B15)*C15)-G15+L15
Named Ranges
NameRefers ToCells
Shares=OFFSET(Prices!$A$2,0,0,COUNTA(Prices!$A$2:$A$25))B15:C19
Cells with Data Validation
CellAllowCriteria
A15:A19List=Shares
 
Upvote 0
In that sample, are all the column M results what you want except cell M18?

If not, then please manually enter a formula in each individual column M cell to give the result that you want.
 
Upvote 0
In that sample, are all the column M results what you want except cell M18?

If not, then please manually enter a formula in each individual column M cell to give the result that you want.
C col. means last price close, F col. means buy price and j Col means sale price. M col. result is diff between sale and buy price. If item still not hv buy or sale price it will calculate last close price that is C col. based price. in M18 i am using this =IF(OR(F18="",J18=""),J18-F18-C18,J18-F18) for result 433-430 = 3 but what happening that sale still no hv price so it taking 0-433-last price 430 = 863 instead of 3 , how to fix that ? if i hv sale price and buy price blank then no issue, this formula work but if i have no sale price or blank and i have buy price then it gives -- to +. That's the issue..
 
Upvote 0
I can't see that you specifically answered my question.
In that sample, are all the column M results what you want except cell M18?

If not, then please manually enter a formula in each individual column M cell to give the result that you want.
 
Upvote 0
I can't see that you specifically answered my question.
Shares Trading (1).xlsx
ACFJMOP
2NameLAST PRICEBUYSALEDiff.I WANT THIS RESULTMANUALY FORMULA IN M ROW
3Silver69033.0069191.0069750.00559559IF(OR(F3="",J3=""),J3-F3-C3,J3-F3)
4Silver69033.0064972.50-4061-4061IF(OR(F4="",J4=""),J4-F4-C4,J4-F4)
5Silver69033.0064845.00-4188-4188IF(OR(F5="",J5=""),J5-F5-C5,J5-F5)
6Natural Gas430.00433.00-863-3IF(OR(F6="",J6=""),J6-F6-C6,J6-F6)
KK
Cell Formulas
RangeFormula
M3:M6M3=IF(OR(F3="",J3=""),J3-F3-C3,J3-F3)
Cells with Data Validation
CellAllowCriteria
A3:A6List=Shares


M6 giving result -863 instead of -3, how to fix this, I post now new example above for easy understanding ? Thanks
 
Upvote 0
Thanks for confirming that the other 3 results are what you want. You have now swapped wanting M6 to -3 whereas you said 3 before, but hopefully that will be easy if I get it the wrong way around.

22 12 25.xlsm
CFJMO
2LAST PRICEBUYSALEDiff.I WANT THIS RESULT
3690336919169750559559
46903364972.5-4060.5-4061
56903364845-4188-4188
6430433-3-3
Formula
Cell Formulas
RangeFormula
M3:M6M3=IF(J3="",C3,J3)-IF(F3="",C3,F3)
 
Upvote 0
Thanks for confirming that the other 3 results are what you want. You have now swapped wanting M6 to -3 whereas you said 3 before, but hopefully that will be easy if I get it the wrong way around.

22 12 25.xlsm
CFJMO
2LAST PRICEBUYSALEDiff.I WANT THIS RESULT
3690336919169750559559
46903364972.5-4060.5-4061
56903364845-4188-4188
6430433-3-3
Formula
Cell Formulas
RangeFormula
M3:M6M3=IF(J3="",C3,J3)-IF(F3="",C3,F3)
Its Awesome, that is exactly i want. Thank you @Peter_SSs
 
Upvote 0

Forum statistics

Threads
1,215,438
Messages
6,124,873
Members
449,192
Latest member
MoonDancer

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