My table is something like below, currently I have a column as category with few types of cat names but now we what to have the categories as column header and the name's attached to it.
Table now;
ID | category | Name |
856| Car | Ford |
432| Motorcycle | Honda|
Desired;
ID| Car | Motorcycle |
856| Ford | (blank) |
432 | (blank) |Honda |
How can I do this?
Say your "Table now" table is named TableNow, and your "Desired" table is named TableDesired. Put this formula into your Car column, and fill over.
=IF(VLOOKUP([#ID],TableNow,2,FALSE)=TableDesired[#Headers],VLOOKUP([#ID],TableNow,3,FALSE),"")
Related
I have an excel workbook where I am trying to count the number of apples in a named table. The workbook has multle sheets each named Jan, Feb, Mar, etc. with a corresponding table range of the same name.
My main worksheet has a list of months as columns and fruit as rows, I want to use a countif or suitable function to count the number of each fruit per month using the column heading as the worksheet portion of the formula.
This is what I have tried, this works, but has to be manually coded for each month, i would prefer it be more dynamic.
=COUNTIF(JAN[Labels],$A2)
Note: A2 contains the word apple
I have tried to get the month from the column date but it doesnt work
=COUNTIF(TEXT(E25,"mmm")[Labels],$A2)
This is roughly what the "master" table should look like (for clarity)
| | Jan-20 | Feb-20 | Mar-20 | .... |
| Apple | 4 | 3 | 5 | ... |
| Pear | 5 | 4 | 9 | ... |
EDIT:
Just to assist with anyone trying to help, this is roughly what a table on another sheet will look like:
| invoice | labels|
| 12535 | Apple |
| 12536 | Pear |
| 12537 | Apple |
This table would be a named table of Jan or Feb, etc.
Please try this:-
=COUNTIF(INDIRECT(TEXT(G2,"mmm")),"A")
G2 contains a proper date.
Here is a variation of the above where column 2 of the table is specified as the range to count in.
=COUNTIF(INDEX(INDIRECT(TEXT(G2,"mmm")),0,2),"B")
If you must use column captions to identify the column I would suggest MATCH to find it.
OK, so I found an answer, combining the above answer by Variatus with an additional new row.
| A | B | C | D |
1| | Jan-20 | Feb-20 | Mar-20 |
2| |JAN[Labels]|FEB[Labels]|MAR[Labels]| <- =UPPER(TEXT(B1,"MMM"))&"[Labels]"
3|Apple | 5 | 7 | 3 | <- =COUNTIF(INDIRECT(B$2),$A3)
4|Pear | 7 | 2 | 9 |
5|Orange| 1 | 3 | 3 |
So formula in B2 makes an uppercase text value of the month from B1 plus the column name Labels.
The formula in B3 (and down) counts the number of instances of the fruit from the named table & column shown in B2.
I have two sheet in excel.
In sheet2 I have a table with these fields:
NAME, SURNAME, CITY, AGE
In sheet1 I have to set field CITY and I want that table under this field will be with all the rows from sheet2 with selected CITY.
If I do a VLOOKUP I obioubsly get only first row of table.
Example:
A | B | C | D
NAME | SURNAME | CITY | AGE
Alex | Green | Rome | 18
Max | Brown | Rome | 21
Mary | White | Milan | 33
George | Violet | Rome | 27
In sheet 1 I have
A | B | C | D
CITY | Rome
NAME | SURNAME | CITY | AGE
VLOOKUP| VLOOKUP | VLOOKUP | VLOOKUP
VLOOKUP| VLOOKUP | VLOOKUP | VLOOKUP
VLOOKUP = VLOOKUP($B$2;Sheet2!A:D;1;0) -->
I wanted ALEX, MAX, GEORGE; I have ALEX, ALEX, ALEX
How can I do this without macros?
Thank you
For a simple data configuration like your sample pu this in Sheet1!A3 and fill both right and down,
=INDEX(Sheet2!A:A,AGGREGATE(15,6,ROW($2:$9)/(Sheet2!$C$2:$C$9=$B$1),ROW(1:1)))
For more complicated data configurations and retrievals put this in Sheet1!A3 and fill right and down,
=INDEX(Sheet2!$A:$D, AGGREGATE(15, 7, ROW($2:$9)/(Sheet2!$C$2:$C$9=$B$1), ROW(1:1)), MATCH(A$2, Sheet2!$1:$1, 0))
Use an IFERROR function 'wrapper' to avoid displaying worksheet errors when you run out of data to retrieve.
I have one column with countries acronymns
SHEET 1
+------------------+
| Country_Acronym |
+------------------+
| EG |
| AE |
| PK |
| IN |
| LK |
+------------------+
I have another sheet with corresponding titles
SHEET 2
+------------------+----------------------+
| Country_Acronym | Country_Name |
+------------------+----------------------+
| EG | Egypt |
| AE | United Arab Emirates |
| PK | Pakistan |
| IN | India |
| LK | Sri Lanka |
+------------------+----------------------+
I need a formula to read the value on the first column of the first sheet and replace the value with the country_name on the 2nd sheet.
So, when you find EG replace with Egypt, when you find PK replace with Pakistan etc
You cannot change the value of cell itself depending on the value within that very self cell - without using VBA.
Instead you may use the below formula on the B2 of Sheet1 & copy down, then copy that column, paste onto Col:A as Values Only.
=VLOOKUP(A2,Sheet2!A:B,2,0)
I was hoping to get some assistance in writing a formula in excel.
I have a table that contains a list of employees and their cell phone number. However, the table is structured in such a way that there is a number of blank and duplicate rows.
Essentially, I am hoping to create a new table without any duplicates and blanks by performing a lookup on the respective cell phone numbers.
The problem is, when I do a standard Index/Match formula, the formula will grab just the first lookup value, which more often than not, is a blank row.
How would I modify this formula to say something like, "Look this value up. If the value is blank, lookup the second value"?
Here is a sample of what the table looks like:
Table 1 (Original)
+---------------+--------------+
| Employee Name | Cell Phone |
+---------------+--------------+
| Doe, John | |
| Doe, John | 111-111-1111 |
| Smith, Eric | 222-222-2222 |
| Jones, Dave | |
| Jones, Dave | 333-333-3333 |
+---------------+--------------+
Table 2 (What I want the table to look like)
+---------------+--------------+
| Employee Name | Cell Phone |
+---------------+--------------+
| Doe, John | 111-111-1111 |
| Smith, Eric | 222-222-2222 |
| Jones, Dave | 333-333-3333 |
+---------------+--------------+
=Index(Table1[Cell Phone], Match([Employee Name], Table1[Employee Name],0))
How about the first non-blank match?
=INDEX(B:B, AGGREGATE(15, 6, ROW($2:$999)/((A$2:A$999=F2)*(B$2:B$999<>"")), 1))
'listobject table alternative
=INDEX(Table1[Cell Phone], AGGREGATE(15, 6, (ROW(Table1[Cell Phone])-ROW(Table1[#Headers]))/((Table1[Employee Name]=F7)*(Table1[Cell Phone]<>"")), 1))
Hi I have a problem with the data validation list in Excel.
First of all I have one table(named: Article) in a protected Tab with four attributes (Name, Sex, Colour, Price). It is possible that two or more articles have the same name and differ by Sex (male or female) or by colour.
Name | Sex | Colour | Price
-------------|-----------|------------|---------
Product1 | Male | Blue | 10
Product1 | Male | Green | 10
Product1 | Female | Pink | 5
Product2 | Male | Grey | 8
Product2 | Female | Orange | 8
In the main Tab I organized the order in an different table (called: Order).
Product | Sex | Colour | Quantity | Price
-------------|-----------|------------|------------|---------
<List> | <List> | <List> | | <Calculation>
The dropdown List for Product (Data Validation | List | Source -> =INDIREKT("Article[Name]"))
and Sex (Data Validation | List | Source -> Male; Female) is easy.
But how I get a list for Colour - depended on Productname and Sex?
For example Product = Product1 and Sex = Male the drop down for colour should contain Blue and Green.
First you need to change the structure of your table. Either copy and transpose this with an array formula, entered as Ctrl+Shift+Enter:
=TRANSPOSE(TABLE)
You need your table in the following form:
Product 1 | Product2 | Product 3
Green | Grey | Pink
Blue | Orange | White
Then, you define each of those columns as a named range. You can select the entire table and go to Formulas > Create from selection (in the Defined Names section). Mark only "Top row" and click ok. Now you have named ranges you can use in your dependent or cascading dropdown list. In this one, your source will be:
=INDIRECT(A1) 'Replace A1 with the location of your first-level dropdownlist
Of course, it becomes considerably more complicated if you need to add an extra condition to your secondary dropdown. Firstly, your table needs to be in the following structure:
Product 1Male | Product1Female | Product 2Male | Product 2Female
Green | Grey | Pink | Red
Blue | Orange | White | Pink
And the formula for your dependent dropdown would be:
=INDIRECT(A1&A2) 'Where A1 and A2 are the locations of your other 2 dropdown lists.
That should work as you need it. Let me know if further clarification is needed.