I copy data from a SQL Server result set and paste it into an Excel spreadsheet. The NULL values need to appear as blanks in Excel, but the default behavior is to show the word, "NULL". For text fields, I can apply ISNULL([field],'') in the original query. But what about numeric fields? I don't want it to be 0, it needs to be blank. Is there a query based solution? I keep forgetting to do find and replace.
This is more of a comment but do to low rep, i'll post as an answer. Excel will not show a blank by default for a number value when pasted into the worksheet. It will interpret (correctly) a blank data point as 0. Since you are willing to find and replace 0s with null values, it seems this is for presentation purposes. If that is the case, I'd suggest conditional formatting. Set when the cell's value = 0 make the text white. if you are applying any mathematics to this column, the effect of a null cell or a 0 cell are the same, thus no impact to formulas/functions.
Related
We use a sheet to look up information. There are 936 rows and will get more as time goes on, however the query returns a blank result (as it should) after row 600, how do i change what the search/lookup area so it will search the whole table on a separate sheet and return the results?
=IFERROR(IF($D$5=""," ",INDEX(allvehicles2,(MATCH($D$5,indexes2,0)),7))," ")
Tried to alter the selection and even moving to another sheet but would not return the results.
If you are able to, try using Tables with the XLOOKUP function.
It simplifies the formula and the table will automatically grow as data is added to it.
This ensures that the formula will use all the data.
Make sure that the data you are using to lookup against is continuous.
That is no empty rows or columns.
Ensure that it has headings.
Turn it into a table by selecting it and pressing Ctrl + T.
You can change the name of your table by selecting the data and not the headers.
Then use the Name box to change the name.
Then use the XLOOKUP function, with the lookup_array and return_array values each being a column in the table. If the value is not found, an empty string will be returned.
Formula structure
=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found])
Example formula based on the screenshot
=XLOOKUP(A2,MyTableName[Key],MyTableName[Value 6],"")
I have my data on Excel and I uploaded in Google Sheets so I can use Google Data Studio, everything in Data Studio so far working good, but I am having trouble in a case.
Few of my fields in Data source have values in numbers from 1 to 1000+ and I chose cell formatting in excel as Numbers with 1000 Separator(,).
In Data Studio data source I changed same field with "Number" but when I try to create a simple Scoreboard on Data Studio, it seems like it's only doing SUM with values lower than 1000, meaning any value with 1000 or above are being skipped.
I can feel this is because of separator(,) which is troubling and I can use:
CAST(REGEXP_REPLACE)
but I want to know that why it's making trouble, even after choosing correct Cell Format?
Sample Data Link: https://datastudio.google.com/reporting/abafc2cb-9033-4851-9f72-02896a91384c
The field ITEM SUPPLIED is a text field and contains numbers formated as text. However, there is a 1000 separator (,) in the text.
Therefore, every , in the field has to be removed. This can be done by the REPLACE function. Then the CAST converts the text to a number.
CAST(REPLACE(ITEM SUPPLIED, ",", "") AS number )
I have 15 Google Workbooks that import into 1 Workbook tab through an Importrange + Query combo function. The data is then queried and transformed across several other tabs, but the problem definitely begins on this tab.
Although I've manually forced a format change to "Number" in each workbook source AND in Columns CO:CQ (where the problematic data lands), all functions see the data as zero or null. Here is what happens when I set a random cell (CW33) equal to a cell in one of the trouble columns (CO33)
However, when I wrap the cell in an =sum(), the workbook returns "0":
I have no idea how to force the workbook to see the values in these rows as numbers without creating an entirely new column - does anyone have any ideas on how to fix it while preserving the column structure?
Thanks!
try:
=SUM(CO33*1)
for multiple cells it would be:
=ARRAYFORMULA(SUM(CO33:CO34*1))
or:
=SUMPRODUCT(CO33:CO34)
AFAIK, in Sheets, a Number formatted cell displays contents right-aligned and Plain-Text are left-aligned. The highlighted cell looks like a text cell.
Try changing the format of cell or column manually to 'Number' from the 'Format' tab.
Can someone tell me how I code in SQL Server so that I am looking in a varchar text column to see if it contains a numerical range within the text?
For example, I'm looking for columns that contain anything between 100000 and 999999. The column may have a value like
this field contains a number `567391`
so I want to select that one, but not if it had
this field contains a number `5391`
For your given example, you can check the digits:
where col like '%[^0-9][1-9][0-9][0-9][0-9][0-9][0-9][^0-9]%'
This is not a generic solution, but it works for your example. In general, parsing strings in SQL Server is difficult. It is better to extract the values you are interested in when loading the data, so the relevant values are correctly in their own columns.
On my first tab, I need to return the data from the second tab, columns A,B and C; only when the value of column A is greater than 0. I have pics to send but don't see a way to upload them. Currently using this formula, but have been unable to expand on it to get what I need.
=VLOOKUP('MSA Units'!A4, 'MSA Units'!A4:C882,1,FALSE)
I have also tried various forms of INDEX and MATCH arguments with no good results.
HERE IS REVISED LINK TO IMAGES: http://imgur.com/a/20J0v
Filter MSA Units and for columnA select all other than (Blanks). Copy ColumnsA:C of what remains visible into Daily Report Coversheet.