SQL Link Refresh Scrambles Order

jarett

Board Regular
Joined
Apr 12, 2021
Messages
179
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have a spreadsheet that is linked to a SQL DB, it is refreshed each time I open it. The file could grow in records and column D is updated each time, I am entering quantities in column E & F, G&H are formulas. I planned on saving it each time I enter values to give me a running average. The first time I saved and reopened it refreshed and my entered values got reordered.

IM_WH_COUNT.xlsx
ABCDEFGH
1Goal = 0% Excellent = 0.9%-5% Good = 5.1%-15% Average=15.1%-25% Needs Attention > 25.1%Inventory Discrepence %54%
2ItemCodeItemCodeDescWarehouseCodeQuantityOnHandQty on ShelfWIP AdditionsUpdated QTYPercent Difference
308-0003188NO HOLES-31-1/2 X 500 .005 WHT00000 
408-0007208120 in.SPACING-31-1/2 x 500' .000320233%
508-0007208120 in.SPACING-31-1/2 x 500' .00300 
608-000720934 in.SPACING-31-1/2 x 500' .0000822450%
708-000721160 in.SPACING-31-1/2 x 500' .0000011#DIV/0!
808-000721260 in. SPACING-19 X 500' .00500040 
908-0007213NO HOLES-19 X 500' .005 WHT OP00051180%
IM_WH_COUNT
Cell Formulas
RangeFormula
C1C1=AVERAGEIF(H3:H5000,">0")
G3:G9G3=[@[Qty on Shelf]]+[@[WIP Additions]]
H3:H9H3=IF([@[Qty on Shelf]]= "","",ABS([@[Updated QTY]]-[@QuantityOnHand])/[@QuantityOnHand])
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C1Cell Value=0textNO
C1Cell Valuebetween 0.009 and 0.05textNO
C1Cell Valuebetween 0.051 and 0.15textNO
C1Cell Valuebetween 0.151 and 0.25textNO
C1Cell Value>=25.1%textNO
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Data in Databases is not naturally stored in a sorted order.
It would help if you describe how the connection to db is established and how the table is updated. But partially updating the table without explicitly stating the sort order may lead to totally scrambled data.
 
Upvote 0
Data in Databases is not naturally stored in a sorted order.
It would help if you describe how the connection to db is established and how the table is updated. But partially updating the table without explicitly stating the sort order may lead to totally scrambled data.
It is connected by a direct connection, the table is updated through the ERP system (Sage 100) that the users use. The only way I can think of is linking the entries I make in the excel file and importing them against the record.
 
Upvote 0
If you want them sorted in a particular order, create a query in SQL that sorts them in your desired order, and then link to that query instead of the underlying table.
 
Upvote 0
If I saved the file as a new file each time we preformed a count, is there a way to run a script to just pull cell C1's value into a new file to keep track of a running average?
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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