Copy data from Excel file Postgresql - excel-formula

I need to copy the data of three columns of the excel file into fifth column for Postgresql for further enter the data into table together. I need to copy the data into this below insert query format.so what would be the formula I need to use in Excel.
INSERT INTO dlhg.traducao_de_protocolo (status, traducao, tipo_do_dive)
VALUES ('', '', '');
I tried in this way but didn't work accurately.
="insert into .....D4 Values )" & "'"& B4 &", "& [#Tradução]

Related

How to only run a formula if the cell is blank

I am writing a formula to run a matching analysis on some elements of a spreadsheet. The column containing the formula already has values filled in, but I need to run the formula on the blank cells. The formula is working but overwriting the current info I have within the filled cells.
I have tried a VBA code which got too complicated and did not work. With VBA I tried inserting the formula into only the blank spaces but was having some issues. I have also tried a basic excel formula.
=IF(COUNTIFS(A:A,A2,BU:BU,"CLOUD")=0,"Not Cloud",IF(COUNTIFS(A:A,A2,BU:BU,"NOT CLOUD")=0,"Cloud","Hybrid"))
VBA Code I tried:
If (IsEmpty(Bucket) Or Bucket = "" Or Bucket = vbNullString) And _
(GetCellValue(.Cells(i, "BU")) = "CLOUD") Then
Range("CC:CC").Formula = "=IF(COUNTIFS(A:A,A2,BU:BU,""CLOUD"")=0,"Not Cloud", _
IF(COUNTIFS(A:A,A2,BU:BU,"NOT CLOUD")=0,"Cloud"","Hybrid"))"
A reminder this is a high-level version
I want that formula to only run in the cells that do not have a value already in place. It should not overwrite the data from the VBA script that I previously ran before doing the formula. The disposition column should be completely full of values. The formula needs to run in only the blank cells.
You could achieve this with an additional column.
In the column to the right of Disposition (insert one if necessary) write the following formula (example for row 2, assuming Disposition is Column C):
=IF(C2=""; [Your formula here]; C2)
This will provide you with a column full of values, anytime you put a value into column C it will override the formula.
Edit: You can then copy this formula down the entire column to achieve the desired effect.

rows to CSV with extra characters

I have the task of creating a simple Excel sheet that takes an unspecified number of rows in Column A like this:
1-10-13
1-12-3
1-15-13
And make them into a comma-separated list in another cell that the user can easily copy and paste into another program like so:
1-10-13,1-12-3,1-15-13
This can be done by and draging down:
=B1&","&A2
However, I need the output to be like such:
GIS_ID in ('WV-1-10-13', 'WV-51-1-12-3', 'WV-1-15-13')
Basically, I need to prepend the whole thing with GIS_ID in ( and then insert WV- before each value AND put each in single '' quotes. Please help. Thanks.
With data in A1 through A3, use:
="GIS_ID in ('WV-" & TEXTJOIN("', 'WV-",TRUE,A1:A3) & "')"
The formula can easily be expanded to handle more than three cells.

Export values to Excel MS Access

I have a table in MS Access having 4 rows with four columns A, B, C, D
I want to export this records into an Excel sheet as follows,
Expected Output :
8 rows in Excel
How Excel should be like
4 rows will be queried from table
A clone of each row but with Column A prefixed with text 'Dummy'
Other column values for the cloned rows are constant
Example :
Table :
How Excel to be exported :
Each row has been cloned with only column A prefixed with text and rest of the column values are constant
I have few options to achieve in form through VBA and would like to hear which one would be optimised way
-Write a Query to select table values,
-Create a temp table (clone the structure of existing table)
-Loop through the Record-set which has queried values
-Fill the Temp table's first column value with Record-set's A column value with prefixed harcoded text and other column values are hardcoded as well
-append two table and export into Excel
-Query from table and export into Excel
-Loop through table and fill Excel cell A6 with tables field(1) with prefix
-Query from table and export into Excel
-Append the excel with hardcoded values for additional 4 rows (not sure append is possible)
Please suggest which way is possible and happy to hear other options I miss.(Never used MS Access before and this is my first hands on. Based on tutorials I got through, I come with above options)
I would suggest writing a query to select the data then union to that query the second dataset you want. Would look something like
SELECT A, B, C, D FROM tble
UNION ALL
SELECT "PREFIX " & A, "IDE", TRUE, FALSE FROM table
Then output the result of this query to excel.

Merge pasted into Excel cells

I have a table in Word, each row is a few lines of text (shift + enter).
When I copy the table to Excel every line of copy to my own line. You can copy (each line where it was used (shift + enter)) to one row in Excel?
My table in Word.
Copied table to Excel.
I want to Row1 Text - Row1 TextC was A1. I know I can merge, but I have a big table and looking for solutions, which will accelerate.
This isn't 'easy' presuming you're comfortable with excel you're going to need to either use the VBA environment or have a few additional columns.
One way would be to identify the 'top' and 'bottom' of each Row by; in column C (starting from C2, C1 is always "top") =if(left(c2,4)<>left(c2,1),"Top", if(left(c2,4)<>left(c3,4),"Bottom","middle"
Then in column D (and cell locking is important, also assumes it goes to row 100, you will need to change this)
if(or(C1={"bottom","middle"}),"",$A1 & " - " & index($A1:$A$100,match("bottom", $A1:$A$100,0)))
This will give you a list, with breaks in which you can either remove by copying and pasting column D to a new sheet as values, pressing F5 and removing blanks. The other way would be to remove duplicates from the pasted list, and then take out the blank wherever it appears.
There may be more efficient ways of doing this, but it's a pretty unique question!
Maudise

excel sheet sub headings as columns

I am totally new to this kind of challenges and not sure any thing available ( not sure even on what base I have to search )
In the below excel sheet image the column 'A' has headings in two places ( row numbers 2,3 and 9,10) . The actual excel sheet has more than six thousand rows and too many sub headings like this ( If it is small file I can do it manually.. but more than 6 thousand rows)
The challenge :- I want to populate E column with "Make" value and F column with " Model" from sub headings . Can I write any rule or macro to populate these columns ? could some one help me ? Thanks for your help
Image Link
or below
Regards
Kiran
If you want to do this solely in Excel you can use the following. This assumes
All Headings are the same for "S.No"
Change the SUBSTITUTE clause to match the text for Make and Model eg I have used exact spacing of "Model: " and "Make : " to match the spreadsheet and substitute with ""
In cell G5 Enter =IF(ISNUMBER(A5),IF(ISERROR(FIND("Model",A3,1)),MAX($G$1:G4),MAX($G$1:G4)+1),"")
In cell F5 Enter =SUBSTITUTE(IF(ISNUMBER(A5),INDIRECT(ADDRESS(MATCH($G5,$G:$G,0)-2,COLUMN(A1),1)),""),"Model: ","")
In cell E5 Enter = =SUBSTITUTE(IF(ISNUMBER(A5),INDIRECT(ADDRESS(MATCH($G5,$G:$G,0)-3,COLUMN(A1),1)),""),"Make : ","")
Then drag down the formula in E5:G5 to wherever you need. However, I only recommend using this once only as the formulae will be slow to update over large ranges. Also if your headings are out of sync then VBA is the way forward

Resources