Missing Data in Excel between 2 columns - excel

I'm working with a fairly large data set, I have a list of names which appear more than once in column B and in column C i have the team they are part of.
In column C which displays there team name most the data is there but I do have a few 1000 where no team name is not present. Is excel smart enough to go for example Jamie#soso is part of design because it case in "B36" "C36" and then assign design to the missing field?
Here is an example of the data with the missing team names
And here is a view with what im looking for end result wise.
If I need to explain this better please let me know and thank you in advance.

On the assumption that there are no ambiguous entries, you could do the following:
if the order of the data is important, add an index column and insert ascending numbers for all rows of data (hint: enter the first two values manually, then select the first two cells and double click the fill handle to fill all the way down to the end of the data)
Sort the data by name and then by team as secondary sort
select column B
hit F5 to open the Go To dialog
click Special button
tick the option Blanks and click OK
now all blank cells in column B are selected
without changing the selection start typing a = sign, then hit the up arrow on your keyboard.
hold down the Ctrl key on your keyboard and hit Enter
now each previously blank cell in column B will have a formula that references the cell above.
copy column B
paste special on column B and paste values to get rid of the formulas
use the index column created in the first step to return to the original sort order
If you want this exercise to be repeatable, you could also use Power Query. Load the data into the Power Query editor, sort by name (ascending) and team (descending), select the Team column and click Transform > Fill > Fill down. The screenshot shows the result

To do without VBA, add a helper column in column C and insert this array formula:
{=INDEX($B$1:$B$17,MATCH(A1 & "?*",$A$1:$A$17&$B$1:$B$17,0))}
To create an array formula, type in the formula without the curly brackets, then press CTRL+SHFT+ENTER. Excel will add the curly brackets.
When you have your column C results, you can copy and paste values to overwrite column B if you want to get rid of your helper column.
This formula looks for rows with a value in A that matches the current row (i.e. same name), and any value in B that isn't blank; "?*" ensures at least one character. The match look up value is therefore A & non-blank B, and the array it's looking in is both A column range and B column range. The INDEX part provides the value from column B if it exists.
Names with no matching column B already completed will give you #N/A so you can manually enter those.

Related

How can I keep the same cell reference in if function, until the if function is true/false?

I have the following function in excel:
INDIRECT(CHAR(COLUMN()+53)&O1+1)
This function has to be the outcome of an if-statement when the statement is true. I don't want the O1 to change to O2, O3, etc.. when I drag the function down, until the statement is true. From there I want the function to change this cell reference in ascending order. So as long as the if statement is false, the reference needs to be O1.
I know that absolute referencing can be used to keep the same cell-reference ($O$1), but then the cell reference doesn't change when the statement is true either.
My data looks like this: enter image description here
My complete formula looks like this: enter image description here
=IF(P2=INDIRECT(CHAR(COLUMN()+51)&O1+1);IF(INDIRECT(CHAR(COLUMN()+51)&O2+1)="";INDIRECT(CHAR(COLUMN()+53)&O1+1);INDIRECT(CHAR(COLUMN()+51)&O2+1));IF(INDIRECT(CHAR(COLUMN()+53)&O2+1)="";"";INDIRECT(CHAR(COLUMN()+51)&O2+1)))
What I want to do is to fill a column with values of the first column in the data until the cells are empty. Then I want to fill the column with data from the i+2th column (so from column C I go to column E). In order for this to happen, I want the first cell of (column E in this case) to stay the same, until column C is empty and the column starts taking values from column E.
I hope that this description gives a clear view of what I want to do.
Thanks in advance.
What I want to do is to fill a column with values of the first column in the data until the cells are empty. Then I want to fill the column with data from the i+2th column (so from column C I go to column E). In order for this to happen, I want the first cell of (column E in this case) to stay the same, until column C is empty and the column starts taking values from column E.
It's not the same kind of solution, but this might suit your needs better than your original formula:
=
IFERROR(INDEX(OFFSET($A$1,2,0,COUNTA(A:A)-1,1),ROW($A1)+0),
IFERROR(INDEX(OFFSET($B$1,2,0,COUNTA(B:B)-1,1),ROW($A1)+1-COUNTA(A:A)),
""))
If you need it for more than 2 columns, just extend the formula by following this pattern:
=
IFERROR(INDEX(OFFSET($A$1,2,0,COUNTA(A:A)-1,1),ROW($A1)+0),
IFERROR(INDEX(OFFSET($B$1,2,0,COUNTA(B:B)-1,1),ROW($A1)+1-COUNTA(A:A)),
IFERROR(INDEX(OFFSET($C$1,2,0,COUNTA(C:C)-1,1),ROW($A1)+2-COUNTA(A:A)-COUNTA(B:B)),
IFERROR(INDEX(OFFSET($D$1,2,0,COUNTA(D:D)-1,1),ROW($A1)+3-COUNTA(A:A)-COUNTA(B:B)-COUNTA(C:C)),
""))))
Sample implementation: https://i.stack.imgur.com/MAtxW.png
I've made considerations for your extra blank row between the header and the first row of data. For anyone wanting to use this formula without the blank row in their data set simply change the Offset-Row parameter from 2 to 1:
=
IFERROR(INDEX(OFFSET($A$1,1,0,COUNTA(A:A)-1,1),ROW($A1)+0),
IFERROR(INDEX(OFFSET($B$1,1,0,COUNTA(B:B)-1,1),ROW($A1)+1-COUNTA(A:A)),
""))
You can stick the formula anywhere in your worksheet, but don't forget to change the column letters to suit the location of your fields. In your case, probably:
=
IFERROR(INDEX(OFFSET($C$1,2,0,COUNTA(C:C)-1,1),ROW($C1)+0),
IFERROR(INDEX(OFFSET($E$1,2,0,COUNTA(E:E)-1,1),ROW($C1)+1-COUNTA(C:C)),
""))
Be aware that you need to make sure your columns don't contain rows with blank cells in between names, as this will cause it to skip an equal number of names at the bottom of the column.
EDIT:
I just realized your system uses semi-colons ";" to parse Excel formulas (mine uses commas ","). Please take note of that when copying these formulas to your spreadsheets. Here's the formula again but using ";"...
=
IFERROR(INDEX(OFFSET($C$1;2;0;COUNTA(C:C)-1;1);ROW($C1)+0);
IFERROR(INDEX(OFFSET($E$1;2;0;COUNTA(E:E)-1;1);ROW($C1)+1-COUNTA(C:C));
""))

Formulas not working in excel when i put 58+2 instead of 60?

I want to put 58+2 instead of 60 in Microsoft Excel cells. But, when I do that the cell is not counted for summation or other functions. How do I put 58+2 in a cell and get results?
If I put =58+2 inside the cell, due to AUTOSUM it automatically turns to 60
enter image description here
You can solve this with a couple of helper columns (which you can then hide from view). I'll give you two options/examples
In the example titled 'From helper columns to display' In Columns C & D I keep the raw values of the marks and the bonus. Then in Column A I use the
formula
=C3&"+"&D3
To give my result. In column F I can then calculate totals etc. based on the columns C and D.
In the example titled 'From display to helper columnns' this assumes you already have the data stored as xx+x. In column C I use the formula
=VALUE(LEFT(A7, FIND("+",A7)-1))
And column D
=VALUE(RIGHT(A7, LEN(A7)-FIND("+",A7)))
To get the actual values. I can then again use these columns to calculate my totals etc.
The columns C & D can be hidden for visual purposes. Both of these scenarios will achieve the same result it just depends what the format of your data is currently in as to which one you would use
For any cell you want to calculate instead of hard-code, add an equals sign at the beginning
=58+2
will be evaluated by Excel to be a function rather than text and will evaluate it.

Excel function to assign certain value to specific attributes while not ignoring blank cells

Here's what my excel table looks like:
example table
I want to populate a column called primary code, where it lists the primary code associated with that value. Essentially, I would like primary code to be 10 for Facility ID=1 and Facility Name=X Site and 15 where Facility ID=1 and Facility Name=Z Site. However, I can't figure out a simple IF function to use because of those blank spaces in the data. The blank spaces essentially mean that the row takes on the value of the previous row. It's not feasible for me to try to fill in those blank cells because my actual data has more than 500,000 observations.
Basically, I need to figure out a code that assigns each facility of the same name the same primary code, which should be the first code listed in that section of facility names. If anyone has any insights, that would really help!
If you don't want to fill in the blank values, you could create a lookup column and then reference that column with a VLOOKUP.
In this example I create a new lookup column as column A, using a formula of:
=C2 & "-" & D2 & "-" & E2
Then I created the Primary Code column in G, using this formula:
=VLOOKUP(C2 & "-" & D2 & "-Primary",A:F, 6, FALSE)
There is a quick method to fill in the blanks.
Highlight the columnn you want to fill in
On the Home tab go to Find&Select
Go to Special
check Blanks "k"
Hit Enter and all blanks in the column will be selected
Then type in = and hit the up arrow and then hold ctrl and hit enter
This should populate all the blanks with the value in the cell above it.
Finally copy and paste values in the column and that should let your IF statement work.

How to Save Edited Data from Filtered Excel Column when filter cleared

I cannot find answer to my need. All searches lead to more complex scenarios or just how to filter.
I have filtered a workbook to only display Rows with values in Column C between .01 and 5.55 successfully.
I then used a formula in a blank column ( J ) to add 1.35 to each of those values successfully. (=Cxx+1.35)
I need to now move those attained values in Column J to the replace the values in C and have those values retained when the filter is cleared.
In Continuing to search - Thru google I found:
https://support.office.com/en-us/art...8-272422419b59
But the method only moves a portion of the cells.
I highlight the modified values in Column J - they appear copied in blocks since there missing row numbers between them.
I highlight the Original values in C - (which is the same size data range) and tied Paste - Paste Values and Paste Special / Values but it does not paste correctly.
The First Cell is the only one that pastes correctly. Only about half the cells are replaced and those values are incorrect.
Am I using the correct method to accomplish my need ? Or am I going about it wrong ? It seems the "logical" way with other things I do in my spreadsheet but ... have not tried to edit filtered info before.
Thanks for looking
Why bother with the filtering?
Use this formula in column J, starting in row 2, copy down and then copy the whole column and use Paste Special > Values to paste into column C
=if(and(C2>=0.01,c2<=5.55),C2+1.35,c2)
Or, if you insist on doing the filtering method:
filter the data
enter your formula in the visible cells
clear the filter
select column J and copy
select column C and use paste special with the options "Values" and "Skip Blanks" ticked.

How to use a named column in Excel formulas

I know how to make a named range in Excel.
I have a spreadsheet, with various columns going across as parameters, and then finally a formula in the last cell. This is repeated many times in each row, with each row having a different set of data, and the formula updated to reference the correct row index.
However, the formula looks like (three rows worth):
=G2*(10*D2 + 20*E2 + 5*F2)
=G3*(10*D3 + 20*E3 + 5*F3)
=G4*(10*D4 + 20*E4 + 5*F4)
I would like to use named ranges, but I can't find a way to do something like
=Count * (10*var1 + 20*var2 + 5*var3)
where count, var1, var2, and var3 automatically update to be the particular column of the current row. I can create a named range for every cell, but that isn't helpful. I can name range the column, but then I can't find a way to put an offset into the formula.
Also the whole point of this is readability, so if it ends up being some nasty complex formula function call, that probably doesn't help too much.
Simple, at least when using Excel 2010:
name your column: select full column, enter name
use column name in formula; Excel will combine the referenced column with the current row to access a single cell.
Using the example from Alex P:
select column D by clicking the column header containing the "D", enter name "input1" into name field, and press Enter.
repeat for columns E to F, using "input2" and "input3", respectively.
Do not define additional names defining names "input1" [...] as in example above!
use the formula as given in the example above
Attention:
Using named columns this way, you cannot access any other row as the one your formula is in!
At least I'm not aware of the possibility to express something like <ColName>(row+1)...
I would suggest creating a Table. Select your range A1:H4, then go to the Tables widget > New > Insert Table with Headers (on Mac). This will mark A2:H4 as body of the table, and A1:H4 as header.
From that, you get:
Whatever you put into the header column will define the name for this column automatically, e.g. Count, Radius, Density, Height
You can then write your formula using =[#Count]*(10*[#Radius] + 20*[#Density] + 5*[#Height])
When you change the formula in cell H2, Excel will automatically "copy down" this formula to all cells in column H. So no more accidental inconsistencies in the formulas.
When you need to add another row, simply click the last cell (in our example H4) and hit Tab. Excel adds another row, and also makes sure to "copy down" your formula into the new row.
If you need a total row, add it with the Total Row checkbox in the Tables widget. Excel adds a total row automatically. If you click any cell in the total row, you can change the "total formula" with the "▼▲" button, for example to calculate the Average instead of the Sum of the column.
If you have a long table and scroll down so that the header is not visible anymore, Excel automatically displays the column header instead of the column names (Count instead of G for example).
I can really recommend the video You Suck at Excel with Joel Spolsky which explains all of that.
Suppose I have the following numbers set up in columns D to F in rows 2 to 4:
D E F G
2 10 15 20
3 1 2 3
4 20 30 40
Now suppose I want the value in column D to be known as input1, column E to be input2, and column F to input3:
In Insert > Name > Define...
input1 RefersTo =OFFSET(Sheet1!$D$2,0,0,COUNT(Sheet1!$D:$D),1)
input2 RefersTo =OFFSET(Sheet1!$E$2,0,0,COUNT(Sheet1!$E:$E),1)
input3 RefersTo =OFFSET(Sheet1!$F$2,0,0,COUNT(Sheet1!$F:$F),1)
Now if I write my formula in column G as follows I should get correct answers:
G2 =(10*input1+20*input2+30*input3) // 1000
G3 =(10*input1+20*input2+30*input3) // 140
G5 =(10*input1+20*input2+30*input3) // 2000
I haven't fully reviewed the previous answers, but I think this is closer to what #Jason Coyne the OP was looking for. So, I hope I get a lot of up votes. ;-)
Excel allows your formula to refer to tables and columns by name if you "Format as Table". Here is an article titled Using structured references with Excel tables that goes into detail.
FWIW, it looks like this feature has been available since Excel 2007.
Here is a screenshot of an example:
You should be able to see the formula in E2 is =[#Count] * (10*[#Var1] + 20*[#Var2] + 5*[#Var3]) which is pretty close to what #jason-coyne wanted to type.
I don't like that you are forced to pick a style (or define a new one if you don't see a style you like). The good news is you can reformat the cells all you wish without undoing the "tableness".
It insists on turning on auto-filter. But, auto filter is easy to turn off (see the Filter Button checkbox under the Table Tools Design menu).
It also insists on having non-empty, unique values in the header row (Which kinda makes sense). If you delete a header cell, or insert a column, Excel will invent a new, unique name and stuff it in for you. D'oh!
If you want a column to not have a header, you can enter an apostrophe (') followed by one or more blanks. Remember header values need to be unique, so keep adding blanks if you want more than one column without a header.
If you would like to download the sample workbook in the screenshot, here is a link: https://filebin.ca/3vfaSDn4NLEA/SampleWorkbook.xlsx
Adding to Alex P's answer:
Instead of using =OFFSET(Sheet1!$D$2,0,0,COUNT(Sheet1!$D:$D),1) as the formula for input1, I recommend to use =Sheet1!$D$2:INDEX(Sheet1!$D:$D,COUNT(Sheet1"$D:$D))
It produces the same result, but it is non-volatile, i.e., only recalculate when a predecessor cell changes. This is much better in a larger model!
If you're using VBA, then you can select the whole column and name it, say MyCol, in the name box (upper left input box). The in your code you can refer to a cell in the column MyCol (line 12) using the following code:
Cells(12, Range("MyCol").Column)
You might be able to use the row() function. This returns the current row that you are in. So depending on the layout of the spreadsheet you can use it like this:
=offset(NamedColumn1, row()-1)
The -1 is because you are saying how many rows to move down from row 1 which if you are in row 1 you want to be 0.
Use the Excel feature called named references.
To name a cell or range of cells
select that cell or range of cells
Enter its name in the Name Box ( its left of the formula widget and has the cell name )
You can't use names that conflict with cell names, like k0.
The named cells can be used if formulas. E.g.,
=pi*radius*radius
I'd like to propose a slight variation of the cell reference made by Dror. This will work as well:
Range("MyCol").Rows(12)

Resources