Replace entire row based on duplicates columns in csv file - csv
I have two csv files, each of which has two columns. File A is the master file which contains the order of the items, which is important. File B has some (but not all) updated information that needs to replace the old information in file A.
How do I replace the old values in column 2 of file A with the new values from column 2 of file B, but only where the values in column 1 are duplicates?
For example:
File A
Name
Number
Bob Smith
12
Mary West
67
Joe Soap
77
Edith Little
41
File B
Name
Number
Mary West
83
Edith Little
16
Desired result
Name
Number
Bob Smith
12
Mary West
83
Joe Soap
77
Edith Little
16
I feel like there should be a simple solution to this that I'm just missing, but I haven't had any luck with searching for a method.
Edit:
I attempted to solve the problem using replace duplicates in google sheets, which resulted in the correct values, but the order was lost. I ran up against the same problem using Sublime Text in that I can keep the new values quite easily, but I can't seem to find a way to keep them in the position of the old values.
Try the following
=INDEX(IFNA({Q2:Q7,IFERROR(VLOOKUP(Q2:Q7,T2:U5,2,0),R2:R9)}))
(Do adjust the formula according to your ranges and locale)
Related
vlookup for each item in comma-separated list
I have two columns of data — id's and data values. I can get vlookup to work if I want to return the correct fruit if I provide an id, but I need to also be able to account for cases where multiple values are provided as well. Put another way, I need to be able to run my vlookup on each item in a comma-separated list in another cell. id fruit input output 2835 apples 4792 pears 2232 bananas 2835 apples 3244 peaches 1199,3244,2835,4790 should be: oranges,peaches,etc… 4792 pears 1199 oranges Lookup multiple values in a single cell (comma separated) and then return the values to a single cell (also comma separated) Vlookup using a comma separated search key in Google Sheets I feel like I'm very close with the linked posts above, but I keep getting errors. This is what I have, though I'm open to an alternative approach (or something using Google Apps Script) =arrayformula(left(concatenate(vlookup(split(D4,","),$A$2:$B$6,2,false)&","),len(concatenate(vlookup(split(D4,","),$A$2:$B$6,2,false)&","))-1))
You can try with this: =IF(ISNUMBER(D4),vlookup(D4,A:B,2,0),join(",",query(A:B,"Select B where A = "&JOIN(" OR A = ",split(D4,",",1,1))))) If D4 is a number (so it's not varios values) it does the VLOOKUP, if it is not it split the values and inserts them in a query, then join the results with commas again. If you want it for the whole column: =BYROW(D2:D,LAMBDA(each,IF(each="","",IF(isnumber(each),vlookup(each,A:B,2,0),join(",",query(A:B,"Select B where A = "&JOIN(" OR A = ",split(each,",",1,1))))))))
Here is an alternative solution using XLOOKUP function: =JOIN(",",ARRAYFORMULA(XLOOKUP(SPLIT(D4,","),A:A,B:B,"",0,1))) Result:
Load incomplete text file into using SSIS
I have a large text file with 7 columns with delimited pipe symbol (|). I need to load into table using SSIS. There are few rows in text file has no data for last column. Since it is not having data, it is just loading the last column as entire row. For example Id|name|lastname|firstname|sal|Email 1 |AABB|AA|BB|20|abc#gmail.com 2|XYZ|X|YZ|30 In this 2nd row I don't have data for email column and not ended with | symbol. After loaded the data into table and data looks like 1 AABB AA BB 20 abc#gmail.com 2 XYZ X YZ 30 XYZ|X|YZ|30 Ideally it should load as blank or NULL for the 2nd row. But it is not happening. Can anyone suggest me how to resolve this issue.
Create txt file with 3 columns from csv file
I am trying to create a txt file with 3 columns to use as a timing file for fMRI analysis. I need to extract the information from one column in a csv file, and add two numbers that are constant for all rows. The data are organised with titles for each columns representing a variable each, and otherwise numbers. I'm having some trouble with this: In the csv file, many rows are blank. I'm not a great coder, so everything I have tried in unix does not give me a txt file with 3 columns. I only get 2 columns in the rows that are blank in the csv file. Naively, I've tried stuff like: awk -F, '{OFS=",";print $40, "2", "1"}' infile.csv > outfile.txt I would prefer choosing columns to extract based on its title (e.g. "reactiontime") instead of its number ($40). Is it possible to do this somehow? In my attempts, the data is still comma separated in the txt file, and I would prefer to change them to tab separated. Does anyone have a general tip or piece of code on solving this kind of problem? I would learn a lot from that and it would also help my immediate issue. Best, Andreas The output I want is something like this: 2 2 1 4 2 1 5.5 2 1 7 2 1 8.8 2 1 9 2 1 11 2 1 12.2 2 1 15.5 2 1 20 2 1 21 2 1 25.5 2 1 27 2 1 The input looks like this: trials_demo.thisRepN,trials_demo.thisTrialN,trials_demo.thisN,trials_demo.thisIndex,trials.thisRepN,trials.thisTrialN,trials.thisN,trials.thisIndex,img.started,img.stopped,key_resp.keys,key_resp.rt,key_resp.started,key_resp.stopped,startClick.started,startClick.stopped,textGender.started,textGender.stopped,choiceGender.response,choiceGender.rt,choiceGender.started,choiceGender.stopped,click.started,click.stopped,key_resp_3.keys,key_resp_3.rt,key_resp_3.started,key_resp_3.stopped,nextClick.started,nextClick.stopped,key_resp_2.keys,key_resp_2.rt,key_resp_2.started,key_resp_2.stopped,infoText.started,infoText.stopped,demo.response,demo.rt,demo.started,demo.stopped,foler.started,foler.stopped,instruksjoner.started,instruksjoner.stopped,happy.started,happy.stopped,sad.started,sad.stopped,fix_test1.started,fix_test1.stopped,fix_test2.started,fix_test2.stopped,text.started,text.stopped,key_scannerwait.keys,key_scannerwait.rt,key_scannerwait.started,key_scannerwait.stopped,profileImg_4.started,profileImg_4.stopped,you_2.started,you_2.stopped,yblack_2.started,yblack_2.stopped,nblack_2.started,nblack_2.stopped,fix1_2.started,fix1_2.stopped,fix2_2.started,fix2_2.stopped,profileImg_2.started,profileImg_2.stopped,word_2.started,word_2.stopped,tilbakemelding_2.started,tilbakemelding_2.stopped,attraktiv_2.response,attraktiv_2.rt,attraktiv_2.started,attraktiv_2.stopped,attraktivTekst_2.started,attraktivTekst_2.stopped,profileImg_3.started,profileImg_3.stopped,moodRating.response,moodRating.rt,moodRating.history,moodRating.started,moodRating.stopped,foler_2.started,foler_2.stopped,happy_2.started,happy_2.stopped,sad_2.started,sad_2.stopped,instruksjoner_2.started,instruksjoner_2.stopped,fix1r.started,fix1r.stopped,fix2r.started,fix2r.stopped,participant,session,date,expName,psychopyVersion,frameRate, ,,,,,,,,9.808291642460063,None,s,1.6973256938272243,10.258865118647009,None,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,143,1,2020_Feb_07_1705,findr,3.2.4,59.768517041775716, ,,,,,,,,,,,,,,9.808291642460063,None,12.015022674224383,None,Menn,0.9867124325364784,12.015022674224383,None,12.910541409969483,None,s,0.6776523915204962,12.910541409969483,None,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,143,1,2020_Feb_07_1705,findr,3.2.4,59.768517041775716, ,,,,,,,,,,,,,,,,,,,,,,,,,,,,13.612686069261144,None,r,23.58497321998675,16.580722495828013,None,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,143,1,2020_Feb_07_1705,findr,3.2.4,59.768517041775716, 0,0,0,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,13.612686069261144,None,None,None,3.002709451733608,None,43.17218368482372,49.17307505178451,43.17218368482372,49.17307505178451,43.17218368482372,49.17307505178451,43.17218368482372,49.17307505178451,40.19522619822328,42.705546306123324,42.67223233843197,43.17218368482372,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,143,1,2020_Feb_07_1705,findr,3.2.4,59.768517041775716, 1,0,1,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,None,None,3.0083721569972113,None,52.18802669584511,58.18914552356,52.18802669584511,58.18914552356,52.18802669584511,58.18914552356,52.18802669584511,58.18914552356,49.20497252200221,51.70471324137725,51.688084382191846,52.18802669584511,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,143,1,2020_Feb_07_1705,findr,3.2.4,59.768517041775716, 2,0,2,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,16,5.703,3.003153287607347,None,61.187218265838055,None,61.187218265838055,None,61.187218265838055,None,61.187218265838055,None,58.204176409363754,60.703914254686424,60.68726815118316,61.187218265838055,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,143,1,2020_Feb_07_1705,findr,3.2.4,59.768517041775716, ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,66.92143940778078,None,s,52.06480291182652,66.92143940778078,None,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,143,1,2020_Feb_07_1705,findr,3.2.4,59.768517041775716, etc.
How to do a partial copy/paste recordset
Under MS Access 2013, I want to copy a record to a new one or an existing record. I wonder if it is possible to do a partial copy/paste. Here is my simple example of my DataSet: PayID PAyDate PeriodeName EmployeeID Income Taxes 001 2019/01/02 1 5 1500 201 002 2019/01/15 2 5 1500 201 003 2019/01/30 3 5 1500 201 004 2019/02/06 4 5 005 2019/02/06 5 5 Please note that my complete datasheet has 12 fields which must be copied) PayID is an autoNumber I would like to be able to: copy/paste Income and Taxes fields to an existing record (ex: PayId#3 to payId#4 ) copy/paste Income and Taxes fields to a new record (ex: PayId#3 to a new one, ie #6) I already have a contextual menu in my datasheet with the standard copy paste command buttons but I don't know how to substitute them for a partial copy paste command. What should I have as OnAction Callback functions? callBackCopy() callBackPaste() Thanks for the support.
It may not be obvious, but you can Copy&Paste ranges of columns and rows (and both) in an Access datasheet. This works in Access 2010 and 2016, so I assume it works in 2013 too. You need to move the mouse cursor to the edge of a cell, so it becomes a "+" icon. Here is a sample video: https://i.imgur.com/H1VHIlo.mp4 (German Access, but you will get the idea) It shows copying 2x2 cells into new records. You can do the same to overwrite existing records, then you must select the matching number of rows as copy target.
Find formula produces negative number
Background: I am using census data from 1999 that is in a text file format. There is not a distinct delimiter being used in the file and excel does not import the data correctly. Excel does separate the rows correctly, however, all of the column data is in a single cell. A sample cell of data is: 01 07000 Birmingham city, AL 249,459 265,940 -16,481 -6.2 1 51 67 I attempted to use the FIND formula to find the word "city", to test the formula, and the result is a negative number. Specifically, the number is "-21". I have looked in a few excel references and I have found nothing to explain this. Any insight is greatly appreciated.