Fill-down formula vs array formula vs table formula - excel

Let's say I have the following Excel table:
To create a new column for Full Name, what is the suggested or more common way to do it:
Doing a scalar formula and then clicking to fill-down such as shown here; or
Doing an array formula such as shown here.
Or I suppose converting it into a table object and then applying a row formula such as shown here. Oddly though, it doesn't automatically fill down the column and you have to fill-down such as in step 1.
Are there any guides on what the suggested way to work with this stuff is? I can't find much on the official Excel site. What is the way this is usually done?

Use the Left, Right, and Mid functions that use Search. These are always dynamic.

Related

How to drag down formula and change COLUMN references instead of ROWS to make a dynamic list?

I've searched around a good amount and I have not found a solid answer for this question, despite a few promising looking question titles.
This question here for example: Drag down formula and change COLUMN references instead of ROWS
Unfortunately only works for specifically referenced cells. I'm working with a data set that is likely to have columns added to it in the future, and I need to pull the first row of these columns dynamically into a vertical list. Because of this, the method accepted as an answer in that question is not a solution for my problem.
I have data coming in like this:
and I'm pulling the Course names into a vertical list like this:
The thing is, more courses are likely to be added in the future, and I'd like to be able to just drag down my formula to pull them.
Try this formula in cell A10 of the first sheet in your question ...
=INDEX($1:$1048576,1,1+ROW(10:10)-10)
... and then drag it down!
The formula works by using the current ROW() number to calculate the required column number, which is passed into the INDEX() function.

Excel formula - Get first occurrence of partial string in rows above cell

I have a table of fruits in Excel 2013.
I'd like to fill the "Category" column by searching from the current row to the top until the first occurrence of "::", which is the keyword for a category in the table.
If there was some way to reverse a range, I could do something like "=Match("::*"; $A6:$A$2)" to find the row. However, this is not possible.
Does anyone know how this might be accomplished using formulas?
Using your provided sample data, and assuming your data is already organized as shown in your sample, you can take advantage of that organization and use this formula in cell C2 and copy down:
=IF(LEFT(A2,2)="::","",IF(LEFT(A1,2)="::",MID(A1,4,LEN(A1)),C1))
Assuming your table is in A1, put this in C3:
=INDEX(A:A, AGGREGATE (14,6,ROW($A$1:A2)/(LEFT($A$1:A2,2)="::"),1))
And copy down.
Here's a kinda different approach. I'm just basically responding to this part of your post to prove this is possible:
If there was some way to reverse a range, I could do something like "=Match("::*"; $A6:$A$2)" to find the row. However, this is not possible.
Reversing a range is possible, it's just tricky.
As you pointed out: $A6:$A$2 won't work since this is equivalent to $A$2:$A6.
However, without getting into the nitty-gritty details, this array formula will reverse this range:
= INDEX($A$2:$A6,N(IF({1},MAX(ROW($A$2:$A6))-ROW($A$2:$A6)+1)))
Note this is an array formula, so you must press Ctrl+Shift+Enter instead of just Enter after typing this formula into a cell.
You could use this in combination with your MATCH formula to get the desired result (which tells you how many rows up the :: row is):
= MATCH("::*",INDEX($A$2:$A6,N(IF({1},MAX(ROW($A$2:$A6))-ROW($A$2:$A6)+1))),0)
(Also haha this is kinda cool: Usually you see MATCH used within INDEX to effectively get a VLOOKUP type of functionality. This is the first time I have ever seen it the opposite way of having INDEX within MATCH.)
Note that I'm not saying this is necessarily the best approach for this specific problem, just proving a point that arrays can be reversed.

Excel: Return header for searched value (multiple instances)

Preferring not to use any macros...
I'm trying to build a formula to be able to search for a specific value within a number of different columns. See mock up.
Desired formula picture:
In the yellow boxes I'm searching for a specific number, and to the right I'm wanting to return the heading that value belongs under.
I've tried using a formula including index, small, search but my experience with arrays is not great.
Any thoughts?
Attaching a picture of the formula I'm using now (only including 3 months). I really don't the way this formula is set up because the data import is not easy to replace. I want the data to live in the columns.
Working, bad not desired picture:
Alternatively, if this formula cannot be done, is there any easy way to convert the data from the desired picture into the format of the not desired picture?
Try this Array Formula which requires confirmation with Ctrl+Shift+Enter instead of Enter alone.
In B14
=IFERROR(INDEX($B$1:$M$1,SMALL(IF($B$2:$M$11=$A14,COLUMN($B$1:$M$1)-COLUMN($B$1)+1),COLUMNS($B14:B14))),"")
and then copy it across and down.

find second match value in bottom up table (Excel)

In Excel I want to use an array formula that automatically shows the 2nd relative value of a vlookup criteria.
I managed to do this in a top-down list, where I add data on top. But am unable to get this working in a bottom-up list.
I visualized the question for your convenience...
Thanks in advance!
I went a different route than what you did. Type the following array formula into cell F2. (I included a line break for readability.)
=IFERROR(INDIRECT(ADDRESS(LARGE(((A2=A$2:A$11)+0)
*((ROW()>ROW(A$2:A$11))+0)*ROW(A$2:A$11),1),COLUMN($A2)+1)),"-")
Switching SMALLto LARGE did it.
The formula of cell F7 should be:
INDEX($B$1:B6,LARGE(IF($A$1:A6=$A6,ROW($A$1:K6),""),2),1)
More info can be found in Patrick G. Matthews's "Finding the Nth Lookup Value in an Excel List.

Can I make a structured reference absolute in excel 07?

I have a table "A" with 2 columns "Foo" and "Bar". I have a formula with the structured reference A[Foo]. When I fill this formula horizontally I want the reference to stay A[Foo] but now, in the second column, the reference turns to A[Bar]. Is there a way to make this structured reference absolute?
It'd be shocking that this isn't supported if not.
Example Formula:
=A[Foo]
Drag that horizontally and Foo changes if the table has multiple columns
You can make the reference absolute by duplicating the reference to column as if it were a range. Looks like the following:
A[[Foo]:[Foo]]
Put A[[Foo]:[Foo]] in your formula and drag across. The reference will remain on the [Foo] column. Note, you have to drag the formula. Copy/paste won't work.
This also works if you want an absolute reference on a cell in the same row of the same table. Assuming the formula is in the Table named "A", the following will anchor the cell in the same row of the formula.
A[#[Foo]:[Foo]]
There is an article and video on my site about this issue where I attempt to explain it clearly. :)
http://www.excelcampus.com/tips/absolute-formula-references-excel-structured-table/
there is a difference between copying and dragging. Dragging is also called "filling" formulas. On Microsoft's support website you will find the following explanation:
Moving, copying, and filling
structured references
All structured references remain the
same when you copy or move a formula
that uses a structured reference.
When you fill a formula, fully
qualified structured references can
adjust the column specifiers like a
series as summarized in the following
table.
So it basically means that the behavior you see is by design. If you want the reference to be absolute you should copy the formula and not drag/"fill" it.
I couldn't make the Control+drag idea work either. However, by selecting the original cell and the ones to be filled and using the Control+R, fill right, shortcut did seem to copy without changing the structured references across columns.
It appears you cannot make a structured reference (.ie - A[Foo]) absolute. If you want to use absolute references in your formula, so you can use the fill handle, use the old method of absolute reference ($A$2 or $A2)
Example:
Table Name: DiscountPricing
A B C D
1 Item Base Price 5% 10%
2 Pencil $0.50 =[Base Price]-([Base Price]* =[5%]-([5%]*
DiscountPricing[[#Headers],[5%]]) *DiscountPricing[[#Headers],[10%]])
3 Pen $1 =$B3-($B3* =$B3-($B3*
*DiscountPricing[[#Headers],[5%]]) *DiscountPricing[[#Headers],[10%]])
See for additional info:
http://www.technicalcommunicationcenter.com/2011/05/31/how-to-use-structured-references-in-ms-excel/
Try inserting the Table name with an INDIRECT function like;
INDIRECT("Table Name[Column Heading]")
In your Case, INDIRECT("A[Foo]")
Now you can drag it horizontally and the column reference stays static !!
It seems that if you hold down Ctrl while copying the formulas, it will remain static/absolute.
http://office.microsoft.com/en-us/excel/HA101556861033.aspx
sounds like your still dragging/filling, aim for the bottom of the cell, not the corner.
Ross

Resources