To to arrange non sequencial IDs in order - excel

I have three excels. All containing same IDs and phone numbers may be differ, Id is alphanumeric and we have total 10,000 records, but IDs are not present in same sequence across all excel sheets.
For example:
If one ID is present in row 2000 in sheet 1, same ID is present at 3200 row and in sheet 3 it is present in row 5200.
Sheet 1 Sheet2
ID | Contact Number| | ID | Contact Number |
MP-XX-098 | 89652395 | | KJ-OP-98 | 3323241 |
KJ-OP-98 | 3323241 | | MP-XX-098 | 89652395 |
OP-MK-09 | 9632211 | | UI-32-09 | 3234521 |
UI-32-09 | 3234521 | | OP-MK-09 | 9632211 |
I need to create single excel to find which system is having different records.
for example
Sheet
ID | Contact Number(1) | contact number(2) |Contact Number(3) |
MP-XX-098 | 89652395 | 89652395 | 89652395 |
KJ-OP-98 | 3323241 | 3323241 | 3323241 |
OP-MK-09 | 9632211 | 9632211 | 9632211 |
UI-32-09 | 3234521 | 3234521 | 3234521 |
Please note I already tried sort A-Z but it is not working.

Vlookup: use vlookup to find the corresponding value in each sheet:
ID | Contact Number(1) | contact number(2) |Contact Number(3) |
MP-XX-098 | =vlookup(a2,sheet1!$A$2:$b$100, 2, FALSE)| =vlookup(a2, sheet2!$A$2:$b$100, 2,FALSE)| 89652395 |
vlookup will search a range for a value (in this case ID) and return the nth column of the row where the value is found.
In this case the range to search is sheet1!$A$2:$b$100, the value to fins in in the first column: a2 and we need the value in the 2nd column: 2

To clarify Ken's answer a bit...
What you'll likely want to do is copy the IDs to a new sheet in, say, column A. then in columns B, C, and D, you'll put formulas such as Ken posted.
Note that Ken's formulas have a typo -- the search value comes first and then the search range. See this page at office.com for more info. So they really should be:
=vlookup($a2, sheet1!$A$2:$b$10001, 2, FALSE)
The first parm for vlookup is the cell address of the value you want to look up. That's the one in the current sheet, over in column A. If your first one is on row 2, then you'd use $A2 in your vlookup formulas. You want the $ before the A so that it always looks in column A, but not in front of the 2 because you want it to use the value on the same row as the formula. (So you can do this in cell B2 and copy it to C2 and D2, then use Fill Down to copy the formulas to all the rows.)
The second parm for vlookup is the search range -- that will be the range containing the ID and Contact Number in each of the other sheets. (e.g., if your ID is in column A and Contact Number in column B and they start on row 2 and there are 10k records, you'd use sheet1!$A$2:$B:10001 where "sheet1" is the name of the first worksheet.)
The third parm is the column in your search range from which you want to copy your value -- in this case, it's the contact number in the second column of the search range. (Note that this the column of the search range, not of the worksheet.)
The last parm, FALSE, just says to use an exact match, rather than find the closest.
Then, if you want to flag those rows where there is a discrepancy (so you can just scan them to find the problems), use something like this in Column E:
=IF(OR($B5 <> $C5,$B5 <> $D5), "***", "")
This will put three asterisks (***) in column E for each row where one of the contact numbers differs from one of the others.
Hope this helps!

Related

Sum All VLOOKUP Matches

I have a sheet where I am recording what I eat:
Another where I keep an index of values to lookup
I tried
=SUM(VLOOKUP('Sheet1'!A2:A11,'Sheet2'!A2:E11,2,FALSE))
but that only returned the first match, so then I tried
=SUMPRODUCT(SUMIF('Sheet1'!A2:A11,'Sheet2'!A2:A11,'Sheet2'!B2:B11))
but that isn't working either.
does anyone have a solution, where I can also multiply the value of the return match by the # of servings in the first sheet?
Thanks!
If you want a single output of calories through SUMPRODUCT then you can use
=SUMPRODUCT(B2:B11*IFERROR(VLOOKUP(A2:A11,Sheet2!A2:B11,2,0),0))
If you are sure that all entries on Sheet 1 can be located on Sheet 2 then you can drop IFERROR portion like
=SUMPRODUCT(B2:B11*VLOOKUP(A2:A11,Sheet2!A2:B11,2,0)).
Beware that if a value is not found in Sheet 2 then formula will produce wrong result as IFERROR will multiply the serving quantity with 0.
I combine 2 tables into one sheet, Table 1 housed in Column A & B and Table 2 housed in Column D & E
In G2, "Total Serving Colories" enter formula :
=SUMPRODUCT(VLOOKUP(T(IF({1},A2:A12)),D2:E12,2,FALSE)*B2:B12)
It's not super-clear what you're trying to get at. But defining the "Calories Per Serving" in a range called "cals",
+---+---------+-----+--------------------------------+
| | A | B | C |
+---+---------+-----+--------------------------------+
| 1 | egg | 3 | =(VLOOKUP(A2,cals,2,FALSE))*B2 |
| 2 | oatmeal | 1.5 | =(VLOOKUP(A3,cals,2,FALSE))*B3 |
| 3 | shrimp | 2 | =(VLOOKUP(A4,cals,2,FALSE))*B4 |
+---+---------+-----+--------------------------------+
Results in:

How can I tell if more than one 'IFS' condition is 'TRUE' and not just the first match?

In Excel 365 I'm using an "IFS" statement to scan through a number of columns to find out if a cell's value is in any of the columns. I believe "IFS" will process all your conditions until it reaches the first one that is "TRUE" then output. However, I'd like to be able to find ALL instances where my condition is true and output or evaluate them all somehow. Is there a way to do this with IFS (or some other method)? I think I'd like to output the matching value for each true condition in a separate row, but anything that could help me see how many matched and/or which column each match is in would be helpful.
The code I have is a bit much to share as my columns are in other workbooks, so I'll just share a close example. This formula would be in a cell that outputs the match, column D below.
A | B | C | D | E
------------------------------------
ColA | Col1 | Col2 | Formula | Notes
------------------------------------
1 | 1 | 2 | 1 | Two matches in same column (Col1)
2 | 1 | 2 | 2 | Two matches in same column (Col2)
3 | 3 | 3 | 3 | Two matches in diff column (Col1 & Col2)
=IFS(
NOT(ISERROR(MATCH(INDIRECT("A"&(ROW())),INDIRECT("B:B"),0))),
INDEX(INDIRECT("B:B"),MATCH(INDIRECT("A"&(ROW())),INDIRECT("B:B"),0)),
NOT(ISERROR(MATCH(INDIRECT("A"&(ROW())),INDIRECT("C:C"),0))),
INDEX(INDIRECT("C:C"),MATCH(INDIRECT("A"&(ROW())),INDIRECT("C:C"),0))
)
Of course the expected output is to dump the matching value of the first condition that's true, but I'd like to output all instances the condition is true in separate rows if possible. Maybe something like this...
A | B | C | D | E
------------------------------------
ColA | Col1 | Col2 | Formula | Notes
------------------------------------
1 | 1 | 2 | 1 | Two matches in same column (Col1)
... | ... | ... | 1 | Two matches in same column (Col1)
2 | 1 | 2 | 2 | Two matches in same column (Col2)
... | ... | ... | 2 | Two matches in same column (Col2)
3 | 3 | 3 | 3 | Two matches in diff column (Col1 & Col2)
... | ... | ... | 3 | Two matches in diff column (Col1 & Col2)
In the above and in my actual case the '...' would display what's in the column of that particular row match, which may vary from one row to another row throughout the worksheets. Basically, column D in the example would be on a separate 'results' sheet with the same amount of columns and column value types as all the 'data' sheets being searched. Furthermore, each column of the 'results' sheet would be a formula scanning that one specific column in all sheets, but only outputting the given column value of the matched row. Something like below...
DATA SHEET
A | B | C
----------------------
FName | LName | Amount
----------------------
John | Doe | 10
Jane | Doe | 4
Jack | Black | 10
RESULTS SHEET
(all cells are formulas)
A | B | C
----------------------
FName | LName | Amount
----------------------
John | Doe | 10 < matching value in C
Jack | Black | 10 < but different A & C
I hope that last part answered any "why" questions. ;)
ADDITION (7/25/19):
Below is the complete formula I'm using on sheets like above, but with more columns. It works well with the exception of my requirement to know where ALL matches occur and not just the first match on the IFS statement. Column "F" is the column I'm matching to output the corresponding value from the column cell on the match's row as found on the data sheets (5 sheets) to the formulated 'results' sheet, as displayed above. The only thing that changes in the formula between cells is the "A:A" to "B:B" etc., including "F:F" (the column with the value to be "MATCHED" from "SOURCES!$B$2"), which I made the last condition in the formula case nothing is found in the other data sheets, pasting its own data in lieu of something like 0, N/A, or FALSE.
=IFS(
NOT(ISERROR(MATCH(INDIRECT((SOURCES!$B$2)&"F"&(ROW())),INDIRECT((SOURCES!$B$3)&"F:F"),0))),
INDEX(INDIRECT((SOURCES!$B$3)&"A:A"),MATCH(INDIRECT((SOURCES!$B$2)&"F"&(ROW())),INDIRECT((SOURCES!$B$3)&"F:F"),0)),
NOT(ISERROR(MATCH(INDIRECT((SOURCES!$B$2)&"F"&(ROW())),INDIRECT((SOURCES!$B$4)&"F:F"),0))),
INDEX(INDIRECT((SOURCES!$B$4)&"A:A"),MATCH(INDIRECT((SOURCES!$B$2)&"F"&(ROW())),INDIRECT((SOURCES!$B$4)&"F:F"),0)),
NOT(ISERROR(MATCH(INDIRECT((SOURCES!$B$2)&"F"&(ROW())),INDIRECT((SOURCES!$B$12)&"F:F"),0))),
INDEX(INDIRECT((SOURCES!$B$12)&"A:A"),MATCH(INDIRECT((SOURCES!$B$2)&"F"&(ROW())),INDIRECT((SOURCES!$B$12)&"F:F"),0)),
NOT(ISERROR(MATCH(INDIRECT((SOURCES!$B$2)&"F"&(ROW())),INDIRECT((SOURCES!$B$13)&"F:F"),0))),
INDEX(INDIRECT((SOURCES!$B$13)&"A:A"),MATCH(INDIRECT((SOURCES!$B$2)&"F"&(ROW())),INDIRECT((SOURCES!$B$13)&"F:F"),0)),
NOT(ISERROR(MATCH(INDIRECT((SOURCES!$B$2)&"F"&(ROW())),INDIRECT((SOURCES!$B$14)&"F:F"),0))),
INDEX(INDIRECT((SOURCES!$B$14)&"A:A"),MATCH(INDIRECT((SOURCES!$B$2)&"F"&(ROW())),INDIRECT((SOURCES!$B$14)&"F:F"),0)),
NOT(ISERROR(MATCH(INDIRECT((SOURCES!$B$2)&"F"&(ROW())),INDIRECT((SOURCES!$B$2)&"F:F"),0))),
INDEX(INDIRECT((SOURCES!$B$2)&"A:A"),MATCH(INDIRECT((SOURCES!$B$2)&"F"&(ROW())),INDIRECT((SOURCES!$B$2)&"F:F"),0))
)
My formulated "results" workbook also has a worksheet named "SOURCES" that I use to paste file names to connect all the data sheets corresponding columns.
Btw, I'm using this as a tool to 'un-merge' customer data between profiles in our LIVE site/database after obtaining all the tables and columns the customer key has been found (using SQL) to then compare it (using Excel) to our TEST site so I can pull apart the data that doesn't belong on the 'kept' record from the LIVE merge. In this case there were 3 records merged. Two records have a profile in the TEST site, while the kept record from the LIVE site actually does not have a TEST record, giving me 5 sheets of data to examine.
Suppose your data starting from the range A2:C2
I thing this formula can help you,
Array Formula (Use Ctrl+Shift+Enter)
=INDEX($A2:$C2,MATCH("OK",IF(ISNUMBER($A2:$C2),"OK",""),0))

How to extract multiple rows that meet a criteria which is given by 2 drop-down lists in EXCEL

I have a sheet that looks like this:
A | B | C | D | E | F
1 NAME | TASK | ADRESS | ORDER_GIVER | COUNT | NOTE
2 DROPDOWN_2 | move | NY, xy_street | Ann | 1 | ...
3 DROPDOWN_2 | fill | CA, yx_street | Rose | 3 | ...
...
100 NAME | TASK | ADRESS | ORDER_GIVER | COUNT | NOTE
101 DROPDOWN_1
102
103 NAME | TASK | ADRESS | ORDER_GIVER | COUNT | NOTE
104 DROPDOWN_1
INITIALLY:
In rows 1-99 you find the tasks with 1 column empty (NAME).
In rows 100+ you find "Tickets" which can be printed (2 rows for example 100-101)
THEN
1, The ORGANISER (me) makes tickets with names, by ctrl+c/ctrl+v the "ticket structure" and by choosing a name from the DROPDOWN_1 list.
2, Then starts to assign the tasks (row 1-99) to people by choosing them from the DROPDOWN_2 list. (note that dropdown name lists contain the same names.)
After this I would like to have the Excel to fill in the tickets by the rows that contain the same name as the ticket. One person can be assigned to more tasks, but one task can only be assigned to one man. (So tickets can have 1 NAME but more rows depending on the 1-99 list.
I am asking you to help me make a formula or function for this "autofill" of tickets because I have been searching for days for a solution however couldn't find a proper one.
In the Similar problems and solutions section you can find 2 links which had the closest answer. Unfortunately neither of them contain dropdown lists. I tried to solve the problem with INDEX(MATCH()) functions, but the problem is that it cannot handle the changes of names.
Thanks you,
Max
Similar problems and solutions:
https://www.get-digital-help.com/2009/09/28/extract-all-rows-from-a-range-that-meet-criteria-in-one-column-in-excel/
Extracting all rows based on a value of cell without VBA
Select A101:F392 and enter this as an array formula (ctrl+shift+enter):
=IFERROR(INDEX(A1:F99,ROUND(MOD(SMALL(IFERROR(CHOOSE({1,2},SMALL(IFERROR(1/(1/MMULT(IF(SMALL(COUNTIF(A2:A99,"<="&A2:A99),ROW(INDIRECT("2:98")))=SMALL(COUNTIF(A2:A99,"<="&A2:A99),ROW(INDIRECT("1:97"))),0,ROW(A2:A98)),{1,1}))+{0.001,-0.001},FALSE),ROW(INDIRECT("1:196"))),COUNTIF(A2:A99,"<="&A2:A99)+ROW(A2:A99)/1000),FALSE),ROW(INDIRECT("1:292"))),1)*1000,0),{1,2,3,4,5,6}),"")

Excel -- Cell Values Match in First Row, Return Values on One Row with Multiple Columns

Here's an explanation of what I'm having difficulty with:
Column A: Lists the Address Book Numbers for different companies (1234, 1235, 1236, etc.)
Column B: Lists the Phone Types (Cell, Fax, Home)
Column C: Lists Company Phone Numbers
Address Book Numbers from Column A are repeated in multiple rows (due to the fact that some companies have more than one Phone Number in Column C)... So, I'm looking to consolidate the Address Book Numbers that are the same (to one row) and have each phone number pertaining to the same address number in additional columns (within that row).
Current Excel Table:
AddressBookNumber PhoneType PhoneNumber
1234 CELL (444)444-4444
1235 FAX (777)777-7777
1234 OFFICE (000)000-0000
1236 FAX (222)222-2222
1234 HOME (555)555-5555
1236 OFFICE (111)111-1111
Would like my Excel Table to look like:
|AddressBookNumber | PhoneType1 | PhoneNumber1 | Phone Type2 | PhoneNumber2 | PhoneType3 | PhoneNumber3 |
|1234 |CELL | (444)444-4444 | OFFICE | (000)000-0000 | HOME | (555)555-5555 |
|1235 |FAX | (777)777-7777 | | | |
|1236 |FAX | (222)222-2222 | OFFICE | (111)111-1111 | |
Essentially, I need to have the phone numbers pertaining to one company all in one row.. would appreciate any assistance on the formula I should use. Thanks!
To get the unique list use this array formula put this in F2:
=IFERROR(INDEX($A$2:$A$7,MATCH(0,COUNTIF($F$1:F1,$A$2:$A$7),0)),"")
Hit Ctrl-Shift-Enter on exit of edit mode instead of Enter. Then copy/drag down till you get blanks.
And to get the numbers put this in G2:
=IFERROR(INDEX($B$2:$C$7,MATCH(1,(COUNTIFS($E$2:E2,$B$2:$B$7,$F$2:F2,$C$2:$C$7)=0)*($A$2:$A$7=$F2),0),MOD(COLUMN(A:A)-1,2)+1),"")
Hit Ctrl-Shift-Enter on exit of edit mode instead of Enter. Then copy/drag down and over till you get blanks.

Structured Reference in an Index/Match Calculated Column Formula for Header Cell Range in a Table

I have this formula in a calculated column that is working great:
=IFERROR(INDEX(Allocation_of_Funds[[#Headers],[End.Nursing]:[Unassigned14]],MATCH(TRUE,INDEX(Allocation_of_Funds[#[End.Nursing]:[Unassigned14]]>0,0),0)),"")
But this formula is giving me trouble and represents what I want in the next calculated column, (based on the value in the previous column above) but it returns a #REF! error:
=INDEX(INDIRECT("Allocation_of_Funds[[#Headers]"&"["&[#[SOURCE 1]]&"]"):[#Unassigned14],MATCH(TRUE,INDIRECT("Allocation_of_Funds[[#Headers]"&"["&[#[SOURCE 1]]&"]"):[#Unassigned14]>0,0),0)
The details of the tables setup is as follows, in case it's helpful:
I have a table with a range of columns and each column represents a different type of account. For each row, any combination of these columns could contain values or blanks, so I've got another set of columns that I want to identify the table column headers for the non-blank columns for each record.
SOURCE1 | SOURCE2 | SOURCE3 | ACCT1 | ACCT2 | ACCT3 | ACCT4 | ACCT5
ACCT1 | ACCT2 | ACCT4 | 500 | 300 | | 100 |
ACCT2 | ACCT3 | | | 200 | 100 | |
ACCT3 | | | | | 500 | |
| | | | | | |
ACCT3 | ACCT4 | ACCT5 | | | 200 | 300 | 50
ACCT1 | ACCT3 | ACCT4 | 123 | | 332 | 100 |
So I need the SOURCE2 column to use the value in the SOURCE1 column to identify the start of the range where I am looking for the next cell with a value, whereby the column header above that value will be returned for the SOURCE2 row value. The same formula will apply to the SOURCE3 column, using the value of the SOURCE2 column to identify the start of the next range.
Thank in advance for picking your brain!
-Lindsay
I used the following formula to pull the headers and place them under the source numbers:
=IFERROR(INDEX($D$1:$H$1,AGGREGATE(15,6,COLUMN($D2:$H2)/ISNUMBER($D2:$H2)-COLUMN($D$1)+1,RIGHT(A$1,1)*1)),"")
I assumed your table's top left corner was in A1 with 1 being the header row and A-C being your source columns and D to H being account columns. The above formula can be placed in cell A2 and copied to the right and down as need be.
You seem to have a grasp of the IFERROR and INDEX function so I will explain the AGGREGATE function:
=AGGREGATE(15,6,COLUMN($D2:$H2)/ISNUMBER($D2:$H2)-COLUMN($D$1)+1,RIGHT(A$1,1)*1)
The AGGREGATE function is a mixture of a bunch of different functions rolled into with the ability to ignore some calculations. Another added feature is that some of the built in functions perform array calculations without the need for arrays.
In this particular case I chose aggregate function 15 which is the same as the SMALL function. I have also told aggregate to ignore calculations which generate errors by using the "6". For the array calculation I have asked it to divide the column number it is working with by the True or False result of that column being a number:
COLUMN($D2:$H2)/ISNUMBER($D2:$H2)-COLUMN($D$1)+1
True in excel math is the same as 1 and False is the same as 0. Anytime the cell is not a number it will try to divide by zero, generate an error, and be ignored by Aggregate function. This basically generates a list of column numbers that meet the criteria of having a number in their column. The subtraction of the D1 followed by a +1 is to convert the column number that is determined, to a relative column under your accounts headers.
The next part of the aggregate function is telling the SMALL operation which number in sorted order needs to be returned. I used the last character in your source header to determine which column number to return. For SOURCE1 the last character is 1 so I want the smallest column number returned. For SOURCE2, the second smallest number is returned. The *1 at the end converts the character to a number instead of 1 as text.
RIGHT(A$1,1)*1
Ergo, if you want to use up to 9 sources you can. You can do more sources as well but you would need to revise this formula or come up with a different way of providing which number of the small list you want returned. And you can expand the D2:H2 reference to be all your accounts, and adjust the D1:H1 reference to cover all your account headers.
Proof of Concept

Resources