=SUM function that returns text result

trodneyrotter

New Member
Joined
Jun 20, 2014
Messages
15
Hi,

I have a spreadsheet, not written by me, that has an error checking process built into it.

This works by using sub-checks to sum a range of cells which if there are no errors return 0 and if there are errors return 1.

The bit I am interested in understanding, is there is an SUM function which returns the result 'ok'.

The main error check is a SUM of the other SUMs and if it is 0 across the workbook, returns 'ok'.

Does anyone know how this is done. I can see how an IF function would return a text result based on numbers, but not sure how this is working.

The main error check is a SUM of the other SUMs and if it is 0 across the workbook, returns 'ok'.

Thanks,

Ryan
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
The SUM function itself cannot return a text string "ok"
But you can use the IF to test if the SUM = 0
=IF(SUM(...)=0,"ok","Not ok")

The thing to consider when testing if the sum is 0 for the purpose of verifying all values are 0 is negative values.
If there are negative values in the range that offset the positive values, then the test is invalid.
-5 0 0 0 5
Sum = 0, but not all values are 0.

If that's a possibility, then you need to actually count the 0's (or count NON 0's).

=IF(COUNTIF(range,"<>0")=0,"ok","not ok")
 
Last edited:
Upvote 0
As already stated, the SUM function cannot return text. But you could custom format your 'SUM' cells to show text. For example, each of the cells in row 4 below has a simple SUM formula summing the 3 cells above. The row 4 cells are custom formatted as follows:

"Not OK";"Not OK";"OK"

Excel Workbook
ABC
121-5
232
3-5-25
4OKNot OKOK
OK
 
Upvote 0
Thanks everyone for your ideas. Peter pointed me to looking at the cell formatting, which is formatted using a custom format of [Magenta]"Err";[Magenta]"Err";[Blue]"OK".



As already stated, the SUM function cannot return text. But you could custom format your 'SUM' cells to show text. For example, each of the cells in row 4 below has a simple SUM formula summing the 3 cells above. The row 4 cells are custom formatted as follows:

"Not OK";"Not OK";"OK"

OK

ABC

<COLGROUP><COL style="FONT-WEIGHT: bold; WIDTH: 30px"><COL style="WIDTH: 69px"><COL style="WIDTH: 71px"><COL style="WIDTH: 72px"></COLGROUP><TBODY>
[TD="bgcolor: #cacaca, align: center"]1[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]-5[/TD]

[TD="bgcolor: #cacaca, align: center"]2[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]2[/TD]

[TD="bgcolor: #cacaca, align: center"]3[/TD]
[TD="align: right"]-5[/TD]
[TD="align: right"]-2[/TD]
[TD="align: right"]5[/TD]

[TD="bgcolor: #cacaca, align: center"]4[/TD]
[TD="align: right"]OK[/TD]
[TD="align: right"]Not OK[/TD]
[TD="align: right"]OK[/TD]

</TBODY>

Spreadsheet Formulas
CellFormula
A4=SUM(A1:A3)

<TBODY>
</TBODY>

<TBODY>
</TBODY>


Excel tables to the web >> Excel Jeanie HTML 4
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,313
Members
452,634
Latest member
cpostell

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