Replace a number with text from a table - excel

I have to pull account reports out of a system but the regions are represented as a number. I have a separate list that has two columns, one with the region name and one with the corresponding number. I'm looking to write a formula that identifies the number in the report column and populates it with the region name from my static table.
Example:
Region List
A1 B1
1 00 London
2 01 West Midlands
3 02 Greater Manchester
Report
A2 B2
1 Customer A 00
2 Customer B 02
3 Customer C 02
4 Customer D 01
5 Customer E 00
As mentioned, I want to populate column B2 with the data from B1. B2's numbers will corrispond with A1's numbers. It's worth mentioning that there are also some variations like 07D or 19H, so the formula would need to take that into account.

Use this function, I hope it will work.
=INDEX('Region List'!$B$1:$B$3;MATCH($B1;'Region List'!$A$1:$A$3;0))

Related

Trying to move information to sheet 2 based on a value of a cell from sheet 1

Column1
Column2
00003002300048421607
09 008A00
00003002300048414074
09 013A00
00003002300048415880
30 001A00
00003002300048418713
30 001A00
00003002300048416955
30 002A00
Lets say this table is in sheet1, I am trying to have a formula move a row into sheet 2 (a1 to a1, b1 to b1, etc.) if the 1st 2 digit number is less than 13 (01-12). For example on row 2 since the 1st 2 digit value is 09 I'd like that row moved to sheet 2, and on the other hand row 3 starts with 30 so I'd like nothing to happen there. Please let me know if you need anymore information to assist me, thank you :)

How would I copy a cell based on multiple cell values

Morning all, I have a question I'm hoping someone can help me with a formula for. I'm trying to return a value from Sheet2 into Sheet1 based on two different criteria. For example:
Sheet1:
Lvl
Amount
ID
1A
$
001
2B
$
002
2C
$
003
1B
$
001
Sheet2:
Lvl
001
002
003
1A
$300
$275
$250
1B
$200
$175
$150
1C
$100
$75
$50
2A
$350
$325
$315
2B
$250
$225
$210
2C
$150
$125
$110
So on Sheet1, if the first column value matches the Sheet2 first column value, then return the value in that row for the correct ID. The completed would be:
Sheet1 (completed):
Lvl
Amount
ID
1A
$300
001
2B
$225
002
2C
$110
003
1B
$200
001
I'm stumped on how to do a multiple lookup like this though and on what formula would go in Sheet1 in the Amount column. Also, I can't use VBA as it is blocked by my company.
Any help would be appreciated!
I would use HLOOKUP and MATCH.
=HLOOKUP(C2,Sheet2!$A:$D,MATCH(A2,Sheet2!$A:$A,0))
MATCH will return the row index of the Lvl that you are looking for. HLOOKUP needs the row index to look in, and it will use the ID number as C2 to find that in the table columns.

Traversing a hierarchy with VLOOKUP

I have the following dataset:
ID Name Level DirectBoss
E1 MegaBoss 1
E2 SuperBoss1 2 E1
E3 SuperBoss2 2 E1
E4 RegularBoss1 3 E2
E5 RegularBoss2 3 E2
E6 RegularBoss3 3 E1
E7 John 4 E5
E8 Mary 4 E6
It defines a pretty conventional hierarchy: a bunch of employees identified by an ID, their name, which level they are placed in the hierarchy, and who is their direct boss.
My problem is that I need to find out who's the boss of a particular employee, but at an specific level. In this example, John's level 1 boss is MegaBoss, level 2 is SuperBoss1, and level 3 would be its direct boss, RegularBoss2.
How could I calculate this with a formula? It looks like a job for some kind of recursive VLOOKUP: I would look for John's direct boss, then for his boss's boss, and stop when I've got to the desired level. But of course conventional VLOOKUP doesn't work this way. Is there some way to achieve this result?
Thanks!

What is the best way to use Index Match in this case?

In the primary worksheet, I have a list of employees in column A, from columns D:ZZ I have basically a calendar in row 11. Where these intersect, I have assigned a task code to each employee to illustrate what they are employed to do that day. I want to dynamically color the coded cell based on the date in the row 11 and code from the column that it was entered. In my second sheet, I have a table of the codes along column A. From columns B:AM, in row 2 (under the header) I have another code that says what type of work it is, in office, on the road, etc. This is the code I am trying to look up with Index Match. In the row with the task code, under each header I have a scheduled date that that particular job will be either in or out or nothing.
I can Index the task column pretty easily, my problem is how would I take the row I get from that, then search only that row for the date that I applied the code to the employee to return the result from row 2 and the column that that date appears?
I have a pretty good understanding of Index/Match in looking up multiple items to return a result. I am having a problem creating a range from a result to find the data I want.
I have tried Indirect and Address as well as Offset, but I don't want this to be volatile as it is being used in conditional formatting over several thousand cells.
Task Code Schedule Worksheet
DAY 1 2 3 4 ...
CODE A S A F ...
96T003 03 May 04 May 05 May 06 May ...
96T004 05 May 06 May 07 Jun 10 Jun ...
96T005 05 May 19 Jul 22 Jul 23 Jul ...
Primary worksheet
SAT SUN MON TUE WED
DATE 01 02 03 04 05
JONES OFF OFF 96T003 96T003 96T004
DAVIS OFF OFF 96T003 96T003 96T005
This formula works, but is "volatile" and I am leary to use it in a conditional formatting function. Is there a way to make it not as volatile?
=INDEX(CMP_FLYCODE,1,MATCH(F11,INDIRECT("'CMP'!"&ADDRESS(MATCH(F19,CMP_ADP,0),1)&":"&ADDRESS(MATCH(F19,CMP_ADP,0),40)),0))
CMP_FLYCODE is a reference to just the A, S and F code row
Expecting to return a letter code A, S or F based on the date and code
Edit: Added the header to the code schedule that is a unique number for the day of the task 1, 2, 3...
I don't think it's too bad, you can just get the entire row from the 2d array B3:E5 in the task sheet using index with the match for the task code in the row parameter and 0 in the column parameter, then match the date in that and use index again to get the required letter code.
This is what my formula looks like:
=IF(C3="OFF","",INDEX(Tasks!$B$2:$E$2,MATCH(C$2,INDEX(Tasks!$B$3:$E$5,MATCH(C3,Tasks!$A$3:$A$5,0),0),0)))
This is my primary sheet:
This is my task sheet:
So to use this in conditional formatting, you would need three rules using custom formulas
=INDEX(Tasks!$B$2:$E$2,MATCH(C$2,INDEX(Tasks!$B$3:$E$5,MATCH(C3,Tasks!$A$3:$A$5,0),0),0))="A"
=INDEX(Tasks!$B$2:$E$2,MATCH(C$2,INDEX(Tasks!$B$3:$E$5,MATCH(C3,Tasks!$A$3:$A$5,0),0),0))="S"
=INDEX(Tasks!$B$2:$E$2,MATCH(C$2,INDEX(Tasks!$B$3:$E$5,MATCH(C3,Tasks!$A$3:$A$5,0),0),0))="F"
with appropriate fill colours.

Excel remove more than 2 duplicate records from a column

Excel has function to remove duplicates but what if i want only first 2 records of each value in a column.
E.g. Sheet
Email Value
abc#gmail.com 23
xyz#yahoo.com 24
sns#abc.com 75
abc#gmail.com 51
lkj#asd.com 85
abc#gmail.com 95
xyz#yahoo.com 52
uhk#asj.com 95
uhk#asj.com 42
Expected Result Sheet
Email Value
abc#gmail.com 23
xyz#yahoo.com 24
sns#abc.com 75
abc#gmail.com 51
lkj#asd.com 85
xyz#yahoo.com 52
uhk#asj.com 95
uhk#asj.com 42
Note that "abc#gmail.com 95" record which was third entry for the email id was removed. All other records has either one or two entries. No record is allowed for more than two entries. I have thousands of these in a sheet and need to only have first two entries of each email. Can anyone tell me how i can i delete more than 2 records as in above example?
create a helper column with the following formula:
Assuming "abc#gmail.com" is in cell A2, enter this formula in cell C2
=Countif($A$2:A2,A2)>2
This will result in a TRUE/FALSE value. Copy/Fill down the formula to the bottom of your list.
Since this formula returns TRUE for the first two instances of the email address, all of your FALSE values can be deleted from your worksheet.

Resources