Excel spreadsheet to overwrite cells using a table of values - excel

I would like to write an excel function, that will replace some cells, containing text, with values from the table. The text in the cell gives correspondence to the table.
For example:
Here i have my cells that I would like to replace/overwrite. I would like to use the Table of values for matching to match my text1_1 with the newtext in Table of values for replacement at (1,1), and so on.
How can I accomplish this?
What I though is that I do the following:
I know that text1_1 is in column 1 in cell to replace table.
So, I know that text1_1 will be in the 1st row of Table of values for matching, I only need to find the column there.
Once, I have the row number r and column number c in Table of values for matching, then I can use the value at Table of values for replacement at (r - displacement, c) to replace my text1_1 in Cells to replace.
It is possible, that there is a more efficient solution, than what I thought out, so in that case, I am very open to see it.
Which functions should I use? If there is no straightforward way to do it, then could somebody give me some guidance?

Here is a suggestion, assuming I understand your question correctly.
As mentioned in the comments, there is no way to place a formula within a cell that will use the contents of the same cell, because it already contains the formula. What you can do is create a new table to fetch out all the new values based on the Table of values for matching. However, I assume here (using your example) that you know in which column / row to look in the tables. In your example the column number of cell to replace was the row number to look at in Table of values for matching, so my solution fits this situation. Nevertheless, you can easily edit it to fit another need, as long as you now in which column / row to look. So lets start:
Create a new table that match the cell to replace table in size.
In the most upper left cell paste the following formula:
=INDEX($G$3:$M$6,A$10,MATCH(A3,OFFSET($G$10:$M$10,A$10-1,0),0))
Drag this formula to all the other cells, and you will see the new values that match the values in Table of values for replacement
Tell me if it answers your question ;)

Related

Excel: Extract data from well beneath unique identifier

I have a spreadsheet full of data (simplified example below) that I would like to extract the number in the well underneath of "Gimme the number" and paste it into a new column on a separate sheet (i.e. if "Gimme the number" is in G6, I would like to retrieve the value for G7). I do not have access to Excel VBA and have not used macros in the past. I found some examples linked below, but, from what I understand, they would return "Gimme the number", or "Gimme" not 19, 20, and 21. I am not sure if a pivot table is appropriate, because I only want information from a single column. I will only have up to 11 values to extract at any given time, so I think a formula would do it. I am just having a hard time coming up with one that works. Any help would be greatly appreciated!
Search for a text string and return multiple adjacent values
Return multiple matches with wildcard vlookup
I am not sure I get the question well, but I try.
First add a column right of the column with "Gimme..." values. Name it e.g. "Next_value" in the first row. Put in the formula referencing previous column next row. If "Gimme..." is in the cell (for instance) E6, than your formula in the cell F6 is =E7. Copy that formula into the whole Next_value column.
Than select area of these two columns (Label, Next_value) and apply the filter from the Data toolbar. Use the small buttons with triangles at the top of the column Label to adjust the filter so only "Gimme..." rows are filtered.
Now, copy values of Next_value column where you like. If you want just the references, use Paste special function from the Home toolbar and click Paste link button.

Make a list of values in one column, which do not exist in a second column

I have a worksheet with two columns of data. Column A contains thousands of records, and Column B contains only a few records. I wish to identify which values in Column B do not exist in Column A, and display these in Column D. What is the quickest way to achieve this? Happy to use formulas, or otherwise.
I would use conditional formatting and filters:
Formula being:
=ISERROR(MATCH(A1,B:B,0))
I'd then filter on highlighted cells, select the cells in column A and use Alt+; to select only the visible cells, then paste in D.
Last, I'd clear all the conditional formatting and clean up anything left.
Using formulae would be a little more complex; usually the most of the time would be spent designing it, and it's an array formula (invoked correctly only with Ctrl+Shift+Enter):
=IFERROR(INDEX($A$1:$A$27,SMALL(IF(COUNTIF($B$2:$B$6,$A$2:$A$27)=0,ROW($A$2:$A$27),9^99),ROW(D1))),"")
The formula can also take some time to calculate for larger datasets.

Select all data in Excel by column name, omitting empty cells

The goal is to create a series of graphs that will update automatically based on the raw data.
So, I have created a graph manually and want to edit the formula to accomplish the auto update.
The column names will always be the same, so I want to be able to select all data in a column based on the name BUT ignore any cell that is blank (above zero maybe).
The formula excel has given me so far is
=SERIES(rawdata!$M$1:$M$6,rawdata!$A$2:$A$37,rawdata!$M$2:$M$37,1)
So, something like
=SERIES(rawdata![column name],rawdata![column name],rawdata![column name],1)
I'm not sure how the skipping blank columns should work either. To expand on this further only one of the columns can potentially contain blank values. So if a cell is blank in that column then that entire row shouldn't be plotted, if that makes sense!
strong text =OFFSET(Sheet1!$B$2,0,0,COUNTA(Sheet1!$B:$B) - 1)
Try this formula when you define the name for the column of values you would like to have data automatically added from. I know it works when each cell has either a formula or a value. Like a column that is automatically calculated based on values in other columns.
In this formula example the cell B2 refers to the first point of data in the column. (make sure your references are absolute! ie, use $B$2)
This automatically returns the range of data as it changes when CountA is added:
=OFFSET(reference, rows, cols, [height], [width])
=COUNTA(value1, [value2], ...)
Hope this helps! It worked for me! :) If you have completely blank cells in the column you might have to make a couple changes though.
-Reverus

Highlight a Cell in Excel Based on Identical Contents in a Column with Varying Contents

I am trying to figure out if it is possible to use a formula with conditional formatting or a VBA macro to highlight a cell based on a cell with identical contents in another column, with varying data.
To explain more thoroughly, let's say I have column A, with unique content in each row, rows 1-280. Each row is formatted to be a string of text, such as "12E00" or "97EBC." I also have column T, which is based on imported data, and may contain some of, but not all of, nor in the same row, the data from column A. It also starts at row 9, not row 1. This is repeated on 47 different tabs, with differing row contents on different tabs (some may have 1-280, others may have 1-160).
Is there some conditional formatting formula/macro (with an explanation of the working components of possible, so that I can learn myself and educate my supervision on the inner workings) that would allow me to highlight any of the cells in column A that have the same text string shown somewhere in column T? Additionally, keeping in mind that I'm checking every row in column A against column T and that column T will only contain some of the text strings in column A.
I assume there is a better way to accomplish this.
But if I understood the question correctly, then try using: =ISNUMBER(MATCH(cell,column,0))
I would then make a column next to Column A for each sheet you want to check.
Example table, with a column for each sheet checked, and a column for checking if any sheets matched. Matched cells are highlighted.
47 columns might be too much to, therefore I used Column B to do:
=OR(Table1[#[sheetName]:[otherSheetName]])
Each column have the formula: =ISNUMBER(MATCH([#[Column A]],INDIRECT(C$1&"!T:T"),0)) (C$1 is pointing to the column's header row)
Utilizing INDIRECT() the column will always look in column T in the sheet with the same name as the column header.
The highlighting is done with these conditional formatting rules

Selecting a Specific Column of a Named Range for the SUMIF Function

I am trying to create a SUMIF function that dynamically adds up values in a specific column of a named range in my Excel sheet.
It is very easy to do this when there is no named range :
The formula picks out all the cells that contain "London" in their name and sums up the expenses related to London.
What I am trying to do is to use a named range called TripsData (A2:B5) and tell the SUMIF function to sum the entries in the column 2 of this range that meet the criterion of having London in their name.
How can I make this work without needing to create a second named range for column 2 and simply by telling Excel to look within the specified column of this named range? Index/Match only return one value so that doesn't work when there are several cells with London in their name.
Thanks for your help!
Use INDEX to refer to a specific column in the named range (it can refer to a whole column), like this
=SUMIF(TripsData,"*London*",INDEX(TripsData,,2))
You can do that without any named ranges at all, if you turn your data into an Excel Table object. Select any cell in the range or the whole range and click Insert > Table or hit Ctrl-T.
There will be a dialog that asks if your table has headers. Yours does. Now you can reference the table and its columns by their inherent names and build your formula like this:
=SUMIF(Table1[Expense],"*London*",Table1[Cost])
You can rename the table, of course, even after the formula is in place. When you click a cell in the table, there will be a new ribbon for commands that relate to tables only. It's a very powerful tool.
Any formulas, formatting etc. that apply to a whole table column will automatically carry over into new table rows. The table column reference will adjust automatically, too, of course, so you don't have to mess with dynamic range names or re-define what a named range applies to.
Note: the formula uses structured referencing instead of cell addresses. This option can be turned off by clicking File > Options > Formulas > tick or untick "Use table names in formulas"
You can use Chris' idea of Index(Table1,,Col#) with the named range "Table1" (without creating an Excel table Object if you don't want to for some reason) and STILL avoid the problem Applez mentions in the comment below Chris' idea. Applez warns that using a constant for a column number reference is dangerous if you later insert another column before that column in the named range. You will find that Excel does NOT auto increment the constant, so your formula breaks.
Applez is right..... so DON'T use a constant, use a column number "reference" instead of a constant. For example....
=SUMIF(TripsData,"*London*",INDEX(TripsData,,Column(B1)))
If you later insert a column between A and B, Excel WILL auto increment the reference Column(B1) to Column(C1). Just don't delete B1 or Row 1 or you will get a REF error. I usually use the the header/tile "cell" (in whatever row that is in) for that table column within the Column reference (as it is highly unlikely I will ever delete the header/title cell of column of a table unless I delete the entire column). In this particular example as it turn out, B1 "IS" the the title/header cell for that column in the data table. So that is what I used for the example.
Awesome formula, just in case anyone needs to use a similar approach to FILTER a range. I used this approach
pmGendHC is the range I wanted to filter (I expect a spilled range with my data) I needed a colum (column number 13) to be different than 0
=FILTER(pmGendHC,INDEX(pmGendHC,,13)<>0)

Resources