Autofill column of an Excel table based on another column - excel

I've created a table with multiple columns in Excel, and I'm trying to let it autocomplete some columns based on another one: There's an "Item name" column and a "Item type" one, and I want to make excel autofill the Item Type field on every row based on the entry in the Item name field on the same row, is there a way to make Excel handle this by itself based on previous entries?
EDIT: Example for clarity:
If I insert "Pizza" in Item Name and "Food" in Item type, when I enter "Pizza" again in another row, Excel auto-fills the same row "Item type" field with "Food"

Based on your edit you want the vlookup function.
VLOOKUP( value, table, index_number, [not_exact_match] )
If index_number is less than 1, the VLOOKUP function will return
VALUE!. If index_number is greater than the number of columns in table, the VLOOKUP function will return #REF!. If you specify FALSE
for the not_exact_match parameter and no exact match is found, then
the VLOOKUP function will return #N/A.
But first you'll need to make sure that these associations are already present. You need a table like this. Assume that 'object' is a1 and 'type' is b1:
Object Type
Pizza Food
Car Vehicle
Now for your table that you're entering the values, assume that 'name' is d1 and 'type' is e1:
Name Type
Pizza =vlookup($d2, $a$2:$b$99, 2, false)
Car =vlookup($d3, $a$2:$b$99, 2, false)
The '$' will prevent the relevant cells from changing if you use autofill to complete the column.
If this is a set list that is relatively short you can manually enter it into the autfill options.
Microsoft gives you all the various ways to do this.
https://support.office.microsoft.com/en-us/article/Fill-data-automatically-in-worksheet-cells-74e31bdd-d993-45da-aa82-35a236c5b5db?CorrelationId=99c7dec0-4c5c-4988-b148-6d3b7c4dd2e5&ui=en-US&rs=en-US&ad=US
Also, creating a pivot table may be what you want to do. Simply highlight your main table and go to the insert table and click pivot table. Move the headers into the appropriate box.
The last option may be your best bet if it involces a ton of values. lookup/match functions will give you a more robust formula that is more versatile.
If you can give a sample set of data and what you want it to look like I can give you the formula.

Related

How to Extract ALL Unique Values from one table's column to another table's column?

I am having serious issues trying to understand absolute reference within TABLES. I do not want to use the =UNIQUE function as it causes #SPILL errors and I need the unique values in another table. Furthermore, the =UNIQUE function is unique to Office 365 and I work in an office where most of our employees use Office 2019, so I really cannot use the =UNIQUE function even if that was the only method.
I have used the IFERROR/INDEX/MATCH/COUNTIF formula to extract all unique values from a column by referencing the cells themselves before, but I cannot reference it properly when extracting from one table into another table. Since I have to extract ALL unique values from one table's column to another table's column, I cannot understand how I should reference these columns or cells.
To the problem, I have two tables (named "ORDER_IN" and "INV") in two separate sheets ("ORDER" and "INVENTORY" respectively). The first table (Table "ORDER_IN" in sheet "ORDER") contains an order history of fruits along with their quantity and date. The columns are: "Fruit Name", "Order QTY", and "Date". The second table (Table "INV" in sheet "INVENTORY") contains "Fruit Name" and "Total IN". The same fruit can be ordered at multiple quantities in multiple dates. I need the workbook to serve two functions:
Sometimes, a new fruit can be ordered; hence, when I add it that "Fruit Name" to my "ORDER_IN", I want it to be automatically added to my "INV" Table. This is what I need help with.
Henceforth, I want that entry in the "INV" Table to automatically sum all values in the "Order QTY" column from "ORDER_IN" table and return the value to its respective "TOTAL IN" column on the "INV" table. I know how to do this using SUMIF.
I have added the images of the tables below. Basically, for example, I want the entry "Mango" to appear only once in the "INV" table with (20+80+80=) 180 under "TOTAL IN".
Table "ORDER_IN" in Sheet "ORDER"
Table "INV" in Sheet "INVENTORY"
Table "INV" in Sheet "INVENTORY" (Completed) [This is what I want, but automatically; below table was manually filled]
Finally managed to find the answer after hours of asking people around:
Type in this formula the Sheet "INVENTORY" on the first row under the Column "Fruit Name":
=IFERROR(INDEX(ORDER_IN[[Fruit Name]:[Fruit Name]], MATCH(0,IF(ISBLANK(ORDER_IN[[Fruit Name]:[Fruit Name]]),1,COUNTIF($A$1:A1, ORDER_IN[[Fruit Name]:[Fruit Name]])), 0)),"")
Then use: CTRL+SHIFT+ENTER
Then Drag the Formula to the rest of the cells and see magic happen every time you enter new unique entries in the "ORDER_IN" sheet.

How to filter one column in Excel Pivot table

I am trying to create a tunnel chart using data from Pivot table. However, I can't find a way to set a condition for one column ("Response Received Column). I want the table to count 5 people, and show 3 people responded. If I do the regular filter, I will only show 3 people on the "Name" column.
Power-pivot solution. can be replicated directly in excel too.
Adding data to model, create an additional column say positive response with calculation as
=IF(Table1[response_received]="Yes", 1,0)
Click pivot table in first menu tab, and get your desired view like this
Note that I have used sum instead of count here.
You can use array formulas - like this.
In the result cell for Name enter formula:
=SUM(IF(ISBLANK(B2:B9),0,1))
the result cell for Response Received enter formula:
=SUM(IF((E2:E9="YES"), 1, 0))
(adjust the row range numbers as you need to match the range of the data)
IMPORTANT!
After you enter the formula you MUST press: (CTRL+SHIFT+ENTER)
That activated the array formula. You can confirm that by selecting the formula cell
and you will see curly brackets around, like so:
{=SUM(IF((E2:E9="YES"), 1, 0))}
Try it.

excel vlookup in tables - search for row and report value in column using column name

I have a database table that is structured like this
SAP Number, FOW, WD, DG
In a different sheet I am using data from this list
It looks like this
SAP Number, WD, DG, ....
The SAP Number is given, WD and DG are searched using VLOOKUP
=VLOOKUP($A2,Objektive!$B:$M,10,FALSE)
This however is difficult to read and could be solved much easier.
I know that the search value is in $A2, and I know that the value is in a tabular named "WD".
Is it possible within Excel to search for the Row similar ot VLOOKUP, but use the column using the column name as [#[WD]]
Here some peudo-code
=VLOOKUPTABLE($A2,Data[#[WD]],FALSE)
If your data table starts from the first column, you can use the COLUMN function to determine the index of the column you want to return data from in the table using the name of that column.
=VLOOKUP($A2,Data,COLUMN(Data[WD]),FALSE)
Alternatively you can use Index/Match to directly reference the columns you want to match and return data from.
=INDEX(Data[WD], MATCH($A2, Data[SAP Number], 0))
If you create a table from the Excel (select any of the cells and press Ctrl + T) you gain access to named references which you can use in Excel formulas. Just make sure your data contains headers.

Excel 2 column comparison: duplicate in one column, but unique as pair

I'm trying to compare values across two columns (Product and Location) in Excel to highlight duplicates, but I can't figure out the logical test. I'm looking for rows that match three criteria:
Product value is duplicate
Product value is not blank
Duplicate 'Product' values occur with different 'Location' values
(Products with the same value in the same location are assumed to be distinct for a value I don't have, but products with the same name at different locations may be duplicate).
Edit: I want the formula to evaluate to true only if the same Product occurs in more than one Location.
I can figure out the first two conditions by themselves, but can't figure out how to incorporate the third. I've sorted the table so that the duplicate values should appear next to each other, but there are too many to check by eye.
I'm currently using this logical test for conditional formatting using the first two criteria. 'Product' occurs in column C, 'Location' occurs in column I.
=AND(C1<>"",COUNTIF($C:$C,C1)>1)
Given your criteria, I think what you need would be the CountIfs function for the 3rd criteria....
Your final formula would look as follows:
=AND($C1<>"",COUNTIF($C:$C,$C1)>1, COUNTIFS($C:$C,$C1,$I:$I,"<>" & $I1)>0)
In effect, your third criteria is saying Count if the product matches C1 AND the Location does NOT equal I1
Hope that does the trick!
NOTE:
The more I think about it, the more I'm pretty sure you do not need your second criteria... I've been trying to think of an example where your second criteria would affect the result of this final outcome, but can't find one....
Just something to consider....
It might be overkill, but how comfortable are you with PivotTables?
Insert a pivot table, and put the "Product" in the row, with the data as the "count" of Location.
Then add a column with a formula similar to:
=GETPIVOTDATA("Location", <top left cell of pivottable> ,"Product", <cell that has product you want a count of>)
The "Location" and "Product" text would have to match your column titles.
The easiest way to get the forumla right is to type "=" in the cell you want to have the value in, and then click on the pivot table cell that contains the value. You then replace the static text, with the cell that has the value you want to look up.

Selecting the max with a condition in excel

I have a range in excel with dates and values
http://lh4.ggpht.com/_i-hI_3gfy08/SoSIopeZUZI/AAAAAAAABEk/KjFnq57VTUc/table.png
EDIT:image added
I want to select the MAX value from the HIGH column for each YEAR (2009 would return 404, 2008 would return 390)
I've done something similar but it's using SUMIF, not MAX.
Any excel people in here that can help me out?
The equivalent of SUMIF in Excel is something like this:
{=MAX(IF(CategoryColumn="High",ValueColumn,"")}
Where
CategoryColumn is the column containing your categories (e.g., "Low", "Med", "High")
ValueColumn is the column containing the data you want to get the max of
NOTE: This is an array formula so you must press Ctrl-Shift-Enter when entering this formula instead of just Enter. Also, don't actually type in the braces {}. The braces show up automatically to indicate that you've entered an array formula.
NOTE 2: You can actually name a range of data. For example, select the range A1:A20. Right-Click and select "Name a Range..." So, for this example, you can select your category column and name it CategoryColumn. Same with ValueColumn.
Array formulas allow you to do IF statements and other functions on a whole range of data instead of just a single value.
This example checks if the value in the "category column" is "High". If it is, it puts the neighboring "value" into the MAX function, otherwise it puts a blank. This gives you the maximum of all the "High" values.
P.S. I don't think the img tag works on this site...can't see your image.
There are three options available.
My preferred option is to create a pivot table without a helper column.
Option 1: Use a pivot table
Create a pivot table of your data.
Set the row to the date field and group it by year.
Alternately a 'Year' helper column could be used by adding a column with this formula.
=YEAR(A2)
Set the data items value portion of the pivot table to be the MAX of your 'High' field
Option 2: Use the DMAX function
Add a helper column titled year with the formula
=YEAR(A2)
Then add a formula for each year
=DMAX(A1:C21,"High",F13:F14)
Option 3: Use an array formula
Enter an array formula for each year using the Ctrl-Shift-Enter keys.
{=MAX(IF(YEAR(A2:A21)=2008,B2:B21))}

Resources