SUM except the strikethrough numbers? - NON_VBA

_Landon

New Member
Joined
Jun 20, 2024
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Hello,

As this is my first post I apologize if this has been answered previously, I am new here and was unable to find any similar posts.

Let me catch you up on what is happening in the background as to why I need this function.

I am running Windows 11 operating through Office365, however my excel document is non-networked and does not need to be connected to any other sheets in order to work. I manually insert the documents I need each week and build a new week version based off the document sheets inserted. My struggle stems from an EXTREMELY tight administrator security system that continuously locks my documents and disables macros due to 365 requiring internet access and the possibility of malware being applied. I have no ability to override in properties as the option has been removed.

I was previously running the VBA script:

Cell F66: =SumNoStrikethrough(O7:O71)

Function SumNoStrikethrough(rng As Range)
Dim cel As Range
Dim s As Double
For Each cel In rng
If Not cel.Font.Strikethrough Then
s = s + Val(cel.Value)
End If
Next cel
SumNoStrikethrough = s
End Function

After running this VBA I would have to manually type ctrl+alt+f9 to get the cell to refresh the new SUM.
I need the SUM of numbers in column "O" to appear in cell F66, and when a number gets strikethrough I need it to automatically update cell F66 with the new SUM. Is there a Formula that can do this without needing access to VBA macros?

Thank you!
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Welcome to the Board!

Unfortunately, native Excel formula can only run off the values in the cells. They do not consider any formatting that may be applied to the cells.
So I don't know how do that without some code of some sort. Maybe instead of strikethrough, you could use some "helper columns/cells" to indicate which cells to ignore that you could incorporate into your formulas?
 
Upvote 0
Welcome to the Board!

Unfortunately, native Excel formula can only run off the values in the cells. They do not consider any formatting that may be applied to the cells.
So I don't know how do that without some code of some sort. Maybe instead of strikethrough, you could use some "helper columns/cells" to indicate which cells to ignore that you could incorporate into your formulas?
Unfortunately I need to use strikethrough to know personnel hours, approved vs. projected vs. cancelled. The strikethrough is the only was to convey that and still have the number within the spreadsheet without deleting.
 
Upvote 0
Well, there is no getting around Excel's functionality. So as I see it you have two options:

1. Petition your security system to allow VBA/Macros. Note that this does NOT have to be done for all Excel files. You can use Trusted Locations to limit it to just files found in a certain location on the directory, or digitally sign your VBA/Macros which then you can set your system to only allow macros with that specific signature.

2. Re-structure the format of your file so that you can do it in another way, like I suggested.
For example, you could have another column to indicate which ones have been cancelled (so you do not need to delete the hours), like this:

1718903000962.png


So cell O13 is just a simple SUM function, but the formula in O14, which excludes the "Cancelled" values looks like this:
Excel Formula:
=SUMIF(P6:P11,"<>C",O6:O11)
 
Upvote 0
@_Landon Here is a possible way you might create a useful 'helper column' ???????

In Name Manager, create a named range 'Struckthro'
In 'Refers To:' enter
Excel Formula:
 =GET.CELL(23,Sheet2!$O7)
then close.

Then formula
Excel Formula:
=O7*NOT(Struckthro)
in P7 and drag down should give values if not struck thro.

Formula in F66 to sum P7:P71

If that is acceptable then you will just need to ensure that the P formulas recalculate.
Using the cell Format options to apply the strikethrough will probably not do it.
Using Paste Format from a struck throough cell should. F9 should.
**Edit. It would appear that the Strikethroughs are not showing in the XL2BB below so I have coloured those cells orange.

AutoTraining.xlsm
FGHIJKLMNOP
6Helper
711
822
930
1044
1150
1260
1377
1488
1599
161010
171111
181212
191313
201414
211515
22160
231717
240
250
26230
272424
282525
292626
302727
312828
322929
333030
343131
353232
363333
373434
383535
393636
403737
413838
423939
434040
444141
454242
464343
474444
484545
494646
504747
514848
524949
535050
545151
555252
56530
57540
58550
59560
60570
61580
625959
63600
64610
65620
661225630
67640
68650
69660
706767
716868
Sheet2
Cell Formulas
RangeFormula
F66F66=SUM(P7:P57)
P7:P71P7=O7*NOT(Struckthro)


Fingers crossed I'm not talking rubbish!
 
Last edited:
Upvote 0
Well, there is no getting around Excel's functionality. So as I see it you have two options:

1. Petition your security system to allow VBA/Macros. Note that this does NOT have to be done for all Excel files. You can use Trusted Locations to limit it to just files found in a certain location on the directory, or digitally sign your VBA/Macros which then you can set your system to only allow macros with that specific signature.

2. Re-structure the format of your file so that you can do it in another way, like I suggested.
For example, you could have another column to indicate which ones have been cancelled (so you do not need to delete the hours), like this:

View attachment 113006

So cell O13 is just a simple SUM function, but the formula in O14, which excludes the "Cancelled" values looks like this:
Excel Formula:
=SUMIF(P6:P11,"<>C",O6:O11)
Thank you, this may be the route I have to take. I will pursue option one like you suggested with regards to allowing it via a digital certificate signature. If that is denied I will most likely add a helper column and run that formula. Thank you for your help!
 
Upvote 0
You are welcome!
Good luck! I hope your Security Department allows the Digital Signature option. That would prevent malicious code, because that code would not be signed.
 
Upvote 0
@_Landon Here is a possible way you might create a useful 'helper column' ???????

In Name Manager, create a named range 'Struckthro'
In 'Refers To:' enter
Excel Formula:
 =GET.CELL(23,Sheet2!$O7)
then close.

Then formula
Excel Formula:
=O7*NOT(Struckthro)
in P7 and drag down should give values if not struck thro.

Formula in F66 to sum P7:P71

If that is acceptable then you will just need to ensure that the P formulas recalculate.
Using the cell Format options to apply the strikethrough will probably not do it.
Using Paste Format from a struck throough cell should. F9 should.
**Edit. It would appear that the Strikethroughs are not showing in the XL2BB below so I have coloured those cells orange.

AutoTraining.xlsm
FGHIJKLMNOP
6Helper
711
822
930
1044
1150
1260
1377
1488
1599
161010
171111
181212
191313
201414
211515
22160
231717
240
250
26230
272424
282525
292626
302727
312828
322929
333030
343131
353232
363333
373434
383535
393636
403737
413838
423939
434040
444141
454242
464343
474444
484545
494646
504747
514848
524949
535050
545151
555252
56530
57540
58550
59560
60570
61580
625959
63600
64610
65620
661225630
67640
68650
69660
706767
716868
Sheet2
Cell Formulas
RangeFormula
F66F66=SUM(P7:P57)
P7:P71P7=O7*NOT(Struckthro)


Fingers crossed I'm not talking rubbish!
Thank you for another option, this is very similar to what Joe4 has suggested also. I believe his method may be much simpler for my needs in terms of visible numbers on the sheet
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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