I have an excel file with patient ID entries and date of blood draw and which tubes were drawn on that date. The way it's currently set up, there's a new line entry for each date (regardless of whether the patient already exists).
How can I easily "transpose" (correct word) the spreadsheet so that there is only one line per unique patient and the multiple dates are converted into additional columns instead of duplicate records?
As suggested by #chancea, you might apply a PivotTable:
If you want actual dates in each row rather than a count to indicate which column is relevant then, in the example in E11 and copied across and down to suit:
=IF(ISNUMBER(E3),E$2,"")
To compact such results you might want to select (in the example D11:L13), Copy and Paste Special..., Values (to D16) then select E16:L18 and HOME > Editing - Find & Select, Replace, Replace with: z, Replace All, OK, Find what: z, Replace with : nothing, Replace All, OK followed by Find & Select, Go To Special..., check Blanks (only), Delete..., check Shift cells left, OK.
Related
Is there a way to add a blank column to a query in Query Studio? I tried to use a calculation on an existing column but the only options that I get are for First Characters, Last Characters, Concatenation, and Remove Trailing Spaces. None of these options allow you to enter a decode, case or IF statement.
Any assistance is greatly appreciated. Thanks.
It's a bit of a hack as Query Studio is really all about making it easy to get data and doing anything with layout is really a job for Report Studio, but you can do the following:
a) create a calculated column on a text field. Select 'Concatenation' as the operation and put a space as the preceding text. Click ok
b1) right-click on the new column and select 'Format', then 'Text' and enter 1 for the number of characters
or
b2) create another calculated column from the first calculated column, set it to 'first characters' and enter 1 for the number of characters. The first calculated column can now be deleted.
Both of these approaches will give a column that only contains a single space - not actually blank but close enough for most purposes. The first approach is a little quicker but may result in the text still existing in some output versions (e.g. csv) - I'd need to do more testing to confirm.
The column title can be edited (to be set to blank) by double clicking it, of course.
Can Not Get My VLookUp In Excel To Return The Requested Data
I am trying to pull data from another sheet based on data selected from a dropdown on the main sheet.
All the formatting is "General"
=VLOOKUP(F15737,'Location Master'!$A:$J,2,FALSE)
It just keeps returning me #N/A
Try using the Index Match method. It's an alternative to Vlookup which doesn't require data to be sorted and can therefore be of more use.
The typical structure of this method is (the text inside the asterisk will give the ranges specific to your sheet:
=INDEX (**Column from which you want to return a value**, (MATCH(**Lookup Value**, **Column against which you want to lookup**,0))
In this case, if I've understood your workbook structure, the formula should look like this:
=INDEX('Location Master'!$B:$B,(MATCH(F15737,'Location Master'!$A:$A,0)))
This is a common problem with VLOOKUP(). Most likely you have some whitespace (A tab character or some spaces) after one of the values. Click on F15737 and see if there are any spaces at the end of it. Likewise, manually find the value in 'Location Master'!$A and check it for spaces or tabs after the value.
If the whitespace is found in F15737 then you can change your vlookup to be:
=VLOOKUP(TRIM(F15737),'Location Master'!$A:$J,2,FALSE)
If the whitespace is in the range to which you are looking up, then you'll need to trim all of those values, which you can do pretty quickly in a new column with the TRIM() formula.
If this doesn't solve the problem then you might have a number stored as text. Generally excel will tell you if this is the case within the cell with a little green corner indicator. To get Excel to automagically change a column from a "Number stored as Text" to a proper number you can:
Highlight the column
Go to Data>>Text To Columns
Click "Fixed Width"
Click "Finished"
Excel will then format everything automatically (dates to dates, numbers to numbers, text to text, time to time, etc.)
I have a large column of texts (5 digit integers concatenated with two letters, like: 12345AB ) and values (up to 8 digit positive integers, like: 12345678) . The list is around 12,200 total and when I do remove duplicates, it reduces to 7015 total. If I sort the result and then do another remove duplicates, I am left with 6324 entries. On the other hand if I sort first and then do remove duplicates, I am left with 6324 entries.
Is this a common issue that when number and text are mixed up that removing duplicates works only after sorting.
I can upload my file if this is not a common issue and is a problem with my file. I'm guessing if the row starts with numbers (text) then the excel search algorithm only goes down the column till such a point that it stops seeing numbers (text) and we miss out on the duplicates that show up later?
I shudder at the thought that I've been using remove duplicates incorrectly all this while.
Please help. Thanks.
EDIT To Include the actual file I am working with:
Link here
seems like you want to ensure is that they're all the same type, no? an easy way to coerce a cell to be text is:
=A1 & ""
and a number is:
=A1 * 1
I was able to accomplish this by using the Text to Columns option.
Select column (B)
Select Text to Columns on the Data Tab
Select delimited click next
Click next as there are no delimiters
Under column data format select Text
Then remove duplicates
I ran into this issue with VLookup before as well it ensures proper formatting of all data in the column.
I have a spreadsheet that I am using as a questionnaire.
One of the questions is Who are your wheel suppliers (mark all that apply)? and there are 6 check boxes in column C to select 5 different wheel suppliers and an Other option. I have these check boxes linked to return whatever suppliers name is selected in the cell adjacent to the cell the check box is in in column I.
So depending on what wheel suppliers the customer selects there could be anywhere from 1-6 different suppliers selected. So once the customer has selected the wheel suppliers whatever suppliers are selected will show up in the correct cell in range I45:50.
What I am having a problem with is that I need these to pull into a data tab into one cell. I am having a problem coming up with a formula to put all the suppliers together as a list in one cell with commas separating each. Remember, it could be 1 supplier, could be 3, could be 6.
Any advice is much appreciated. I have tried using If formulas and Concatenate but I can't seem to figure out how to get it to work like I want it to.
=CONCATENATE(Questionnaire!I45," ",Questionnaire!I46," ",Questionnaire!I47," ",Questionnaire!I48," ",Questionnaire!I49," ",Questionnaire!I50)
That is the best I've come up with but the problem with it is if the first supplier isn't selected then it will enter that space anyways and if the first supplier and the last supplier are selected it will have all those spaces in between.
Another method, this one using helper cells.
Say you have the data in A1:A6. In B1, input this formula: =IF(LEN(A1)>0,A1&",",""). Drag down to B5.
In B6, slight variation: =IF(LEN(A6)>0,A6,",""").
In C1: =CONCATENATE(B1,B2,B3,B4,B5,B6).
What happens is the cells in the B column checks if their respective values in the A column are not blanks. If not, they will append , to it. Otherwise, they will return blanks (not spaces). The only variation is B6--since it's the end of the list, there's no , appended to it.
It's only a matter of concatenating them at this point. Removing any of the values in A, maybe by unchecking their checkbox, will reflect the change in C1 properly.
Let us know if this helps.
EDIT:
To accommodate your formula, change your CONCATENATE formula to something like below:
=LEFT(CONCATENATE(...),LEN(CONCATENATE(...)-1)
What is does is it removes the rightmost character by getting, from the left, all the characters up until one less than the length of the result. Obviously, fill in the ... with the ranges you want to concatenate.
Let us know if this is what you need.
FURTHER EDIT:
=LEFT(CONCATENATE(Questionnaire!F45,Questionnaire!F46,Questionnaire!F47,Questionnaire!F48,Questionnaire!F49,Questionnaire!F50),LEN(CONCATENATE(Questionnaire!F45,Questionnaire!F46,Questionnaire!F47,Questionnaire!F48,Questionnaire!F49,Questionnaire!F50))-1)
Looks ugly, right? But does the job. Better if you use a named range, though, like below:
Now it's much shorter. Error on my end is because I don't have Questionnaire sheet, obviously.
If J44 is blank and you are prepared to add something like =IF(ISBLANK(I45),J44,J44&I45&", ") in J45 (copied down) then perhaps:
=SUBSTITUTE(LEFT(wheelC,LEN(wheelC)-2),0,"")
might suit, where wheelC is a named range of workbook scope for Questionnaire!J50.
I need to delete all text to the right of the first "|" in a group of cells.
I had been using this:
=IFERROR(RIGHT(input,LEN(input)-FIND("stack",input)+1),"")
to delete to the left of a specific character. I found this in a stackoverflow question.
I am not sure how to make it so it reads to find the FIRST specific character. I also am trying to delete to the right of, but I believe I can fix that myself.
Thanks in advance
Assuming by the first "|" in a group of cells you mean the leftmost pipe character in each cell of an array of cells then as #Aprillion suggests =LEFT(A1,FIND("|",A1)-1) seems a good approach (where A1 is the first element of the array and the formula is copied across/down as appropriate).
If the group is a column, an alternative could be to use Data > Data Tools – Text to Columns with Delimited and Other: |, then delete inserted columns as required.