How to sum columns only intregral numbers despite that have rows with text, decimals and percentual values?

Lacan

Board Regular
Joined
Oct 5, 2016
Messages
237
Office Version
  1. 365
Platform
  1. Windows
Hello Guys,
Hope you are OK!

Have 2 largest columns however in the example below that are only a sample
How to sum columns only intregral numbers despite that have rows with text, decimals and percentual values?
Thanks for all the help!!! 👍👍

Painel FARMÁCIAS_21.JUL.xlsx
ABCDEFGHI
1
2
3SALES ASALES B
4PYG MTH %Var MS (p.p.) PY MTH
5-3%-0,18
6OBJECTIVO1 100
71 000
8-0,55
910%500
101 869GOAL
11498
12TOTALTOTAL
13
14
15
Folha1
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Cheers. glad it is sorted. :)
Dear @Peter_SSs

After test it in my workfile just notice a simple gap.
The sum only occurs when cells have numeric values and not in the other ones wich contains formulas that return numeric values.
Can you please give a hand?

Thanks again!!! đŸ‘đŸ‘đŸ»
 
Upvote 0
.. not in the other ones wich contains formulas that return numeric values.
Are you sure the formulas are returning numeric values?
Works for me with formulas.

Lacan.xlsm
CDE
1
2
3SALES ASALES A
4PYG MTH %PYG MTH %
5-3.143%-3.143%
6OBJECTIVOOBJECTIVO
710001000
8-0.6789-0.6789
910%10%
1010001000
110.390.39
127000%7000%
1310001000
14TOTAL30003000
Sheet2
Cell Formulas
RangeFormula
D3:D13D3=E3
D14:E14D14=SomaINT(D5:D13)


Perhaps you could provide some sample data that demonstrates the issue for you?
 
Upvote 0
Are you sure the formulas are returning numeric values?
Works for me with formulas.

Lacan.xlsm
CDE
1
2
3SALES ASALES A
4PYG MTH %PYG MTH %
5-3.143%-3.143%
6OBJECTIVOOBJECTIVO
710001000
8-0.6789-0.6789
910%10%
1010001000
110.390.39
127000%7000%
1310001000
14TOTAL30003000
Sheet2
Cell Formulas
RangeFormula
D3:D13D3=E3
D14:E14D14=SomaINT(D5:D13)


Perhaps you could provide some sample data that demonstrates the issue for you?

Dear @Peter_SSs

After test it would like to make a simple change.
Have to turn back, in your sum through VBA Code can you please add also decimal values. Have also to sum them.
All the rest are OK not "%" and not "text"!
Sorry! Thank you very much!đŸ‘đŸ‘đŸ»
 
Upvote 0
What happened to the issue you raised in post #22?

Is this what you want for the new request?

VBA Code:
Function SomaNotPercent(rng As Range) As Double
  Dim c As Range

  For Each c In rng
    If IsNumeric(c.Value) And InStr(1, c.Text, "%") = 0 Then SomaNotPercent = SomaNotPercent + c.Value
  Next c
End Function

Lacan.xlsm
CDE
1
2
3SALES ASALES A
4PYG MTH %PYG MTH %
5-3.143%-3.143%
6OBJECTIVOOBJECTIVO
710001000
8-0.6789-0.6789
910%10%
1010001000
110.390.39
127000%7000%
1310001000
14TOTAL2999.71112999.7111
Sheet2
Cell Formulas
RangeFormula
D3:D13D3=E3
D14:E14D14=SomaNotPercent(D5:D13)
 
Upvote 0
Brilliant @Peter_SSs đŸ”đŸ‘đŸ‘đŸ»
Will use both codeÂŽs each one for each column.
Thank you very much!!!
 
Upvote 0
You're welcome, but did this issue just go away?
The sum only occurs when cells have numeric values and not in the other ones wich contains formulas that return numeric values.
 
Upvote 0
You're welcome, but did this issue just go away?

After send the question just notice that the numeric values returned by the formulas were really decimal values.
Because of the cells formatt they were "hiding" the decimal places.
Thanks again @Peter_SSs đŸ‘đŸ‘đŸ»
All the best!
 
Upvote 0
After send the question just notice that the numeric values returned by the formulas were really decimal values.
Because of the cells formatt they were "hiding" the decimal places.
OK, thanks for explaining. (y)
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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