How to make it a real zero "0".

Romano_odK

Active Member
Joined
Jun 4, 2020
Messages
379
Office Version
  1. 365
Platform
  1. Windows
Good afternoon,
My sheet gets it data from SQL using a query. When I refresh I get some huge numbers back that are '0' (column K) when you change from "General" to "Number" with 1 decimal, but the fact stays that underneath its still a huge number. What I would like is for these number to become a real Zero (0) after refreshing using VBA. Is this possible?

Thank you for your time.

Locatie controle 3.16f beta.xlsm
ABCDEFGHIJK
5ArtikelcodeOmschrijvingKostprijsOntvgstdatumAantalWaardeVrrdrekStd_locatieMagazijnLocatieVoorraad
6103017Vitoglas 110 celband 9x8 mm grijs - 10x10 m1,0007/12/20225203901P07B1A000,0
7106001Coroplast AWX celband 6x2 mm zwart - 15x25 m folie1,0024/07/20205003901L06A1A000,0
8133091Kunststof Rasterblok 22x6 mm zwart - 100 stuks1,0025/05/202310003901B04B1A000,0
9133093Kunststof Rasterblok 24x1 mm wit - 100 stuks1,0028/07/202339003901A061A000,0
10133095Kunststof Rasterblok 24x2 mm blauw - 100 stuks1,0028/08/202332003901A071A000,0
11134011Kunststof Tunnelblok 22x3 mm rood - 100 stuks1,0011/09/202369003901A031A000,0
12134019Kunststof Tunnelblok 24x3 mm rood - 100 stuks1,0029/06/202370003901A081A000,0
13134021Kunststof Tunnelblok 24x4 mm geel - 100 stuks1,0028/08/202359003901A091A000,0
14134023Kunststof Tunnelblok 24x5 mm groen - 100 stuks1,0031/08/202325003901A101A000,0
15134027Kunststof Tunnelblok 26x3 mm rood - 100 stuks1,0013/07/202330003901A171A000,0
16134029Kunststof Tunnelblok 26x4 mm geel - 100 stuks1,0030/08/202320003901A181A000,0
Boekingen
Cell Formulas
RangeFormula
F6:F16F6=[@Kostprijs]*[@Voorraad]
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Those are not huge numbers, they are tiny. The simplest way would be to alter the query - what is it?
 
Upvote 0
Those are not huge numbers, they are tiny. The simplest way would be to alter the query - what is it?
Yes indeed, the better description would have been large numbers.
select top 100 percent

s.itemcode as Artikelcode
, i.Description as Omschrijving
, i.CostPriceStandard as Kostprijs
, o.datum as Ontvgstdatum
, o.binnen as Aantal
--, r.GLStock as Vrrdrek
, max(i.GLAccountDistribution) as Vrrdrek
, s.Warehouse as Magazijn
, v.maglok as Std_locatie
, s.WarehouseLocation as Locatie
, sum(s.quantity) as Voorraad


--, sum(s.freestock) as Voorraad
from StockBalances s with (nolock)
inner join items i with (nolock) on i.ItemCode = s.ItemCode
left join ItemAssortment r with (nolock) ON i.Assortment = r.Assortment
left join voorrd v with (nolock) ON v.artcode = s.itemcode and v.magcode = s.Warehouse
left join _cop_laatste_ont o with (nolock) on o.artcode = s.ItemCode
left join grtbk g (nolock) on i.GLAccountDistribution = g.reknr
where 1=1
and g.omzrek = 'G'
 
Upvote 0
Yes indeed, the better description would have been large numbers.
Again, no. They are very small (or they wouldn’t round to 0).

What type of database is the source, and how are you connecting to it?
 
Upvote 0
Again, no. They are very small (or they wouldn’t round to 0).

What type of database is the source, and how are you connecting to it?
Ok so my English isn't perfect, but I try and yes its a long number. Its a connection to a SQL database. I connect though Data\Queries and connection.

Connection string: DRIVER=SQL Server Native Client 11.0;SERVER=kohlersql01;UID=Romano;Trusted_Connection=Yes;APP=Microsoft Office;WSID=RKE-PC01;DATABASE=100;
 
Upvote 0
Do you know what data type the quantity field in the database is? It seems very odd that summing quantities would produce this problem, but you may have to simply round the result of the sum in the query: ROUND(sum(s.quantity), 1) as Voorraad for instance
 
Upvote 0
Do you know what data type the quantity field in the database is? It seems very odd that summing quantities would produce this problem, but you may have to simply round the result of the sum in the query: ROUND(sum(s.quantity), 1) as Voorraad for instance
Good morning, that "simple" suggestion worked. Thank you for that advise and have a great day.
 
Upvote 0

Forum statistics

Threads
1,215,320
Messages
6,124,238
Members
449,149
Latest member
mwdbActuary

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