Vlookup or Match and Continuous Numbering - indexing

I am having a difficult time figuring this out and your help is greatly appreciated!
If there is the same name across multiple sheets, I would like the the number first assigned to them to populate and the remaining numbers to be in numerical order throughout the remaining sheets.
Below is sheet 1. C9 has a star near the name because it is a duplicate in sheet 2 (to follow)
Below is sheet 2. C9 is the duplicate name from sheet 1. I need the numbering for sheet 1 to remain as is and sheet 2 as 1, 8, 9, 10, 11, etc.
I am up for 2 options:
Manually enter 1 in cell B9. When I currently do this on sheet 2, the numbers start over again from 1 as opposed to the MAX number from sheet 1.
Automatically populate number when there is a name match. I have tried vlookup and match with my current formulas and they do not work with continuous numbering.
Below are my current formulas:
Cell B9, sheet 2
=MAX('Sheet 1'!B9:B66)+IF(ISTEXT(C9),1,"")
Cell B10:B66, sheet 2
=IF(ISTEXT(C10),IF(OR(ROW()=9,IF(ROW()=9,TRUE,MAX(INDIRECT("B9:B"&ROW()-1))=0)),MAX(INDIRECT("Sheet"&RIGHT(REPLACE(CELL("filename"),1,FIND("]",CELL("filename")),""),LEN(REPLACE(CELL("filename"),1,FIND("]",CELL("filename")),""))-5)*1-1&"!C:C"))+1,MAX(INDIRECT("B9:B"&ROW()-1))+1),"")
I really appreciate your time and help!!

Assuming B8 in Sheet2 is not numeric, names do not repeat within any one sheet and only two sheets are involved, I suggest in B9 of Sheet2 and copied down to suit:
=IFERROR(INDEX(Sheet1!B:B,MATCH(C9,Sheet1!C:C,0)),MAX(Sheet1!B:B,B$8:B8)+1)

Related

VBA script to select data under specific column depending on date

Currently taken over a new role at work and I'm wanting to make my job a lot easier.
I have three sheets within one workbook.
Sheet 1 - Config
Sheet 2 - Overall
Sheet 3 - This Week
What I want to do is depending on the date in sheet 1, I want it to find the corresponding date in the headers on sheet 2, and then select the data in the column and paste it to sheet 3.
For example: If Sheet 1 is 13th May 2018
Sheet 2, D2 - D4 will be copied to Sheet 3 B2 - B4
Is this possible in a macro?
Thanks!
Why not simply use a formula ?
In Sheet3, range B2 :
=OFFSET(Sheet2!$A2,0,MATCH(Sheet1!$A$1,Sheet2!$A$1:$F$1,0)-1)
You can copy this formula in Sheet3, range B2:B4
Two things to check :
The format of the date you are looking for.
The size of the range you are looking up for that date. Column F might not be the last column of your data.

MAX function : Display name of sheet where the answer is

I have several sheets in my Excel file, all named according to a day of the month (So from 1 to 31). I also have another sheet named "totals". In this sheet I have a MAX function that returns the highest number in cell Q31 from ALL sheets. In short, I ask to Excel: What is the highest number among the 31 "Q31" cells. Excel gives me the answer, for example, 54.
I would rather have Excel give me the name of the sheet where it finds the answer.
Is it possible?
Thanks!
In A1 through A31 enter:
=INDIRECT(ROW() & "!Q31")
then in B1 enter:
=MATCH(MAX(A:A),A:A,0)
(assumes the sheets are "named" 1,2,3,... and the worksheet name corresponds to the row number in column A)

how to create a column that only gets the matching value from another sheet in EXCEL

i would like to create an extra column in sheet one which displays a character (for example G) after it finds the matching values from sheet 2.below are two screen shots i have taken for all your conveniences.
please note,in sheet 1 i have marked two rows with identical bs_cd 6374 which matches the bs_cd 6374 in sheet 2 also.what i want is to have a character G in sheet 1 under column G.
thanks in advance
Insert into the cell G2 this formula and drag it down:
=IF(VLOOKUP(B2;Sheet2!$A$2:$A$100;1;FALSE)=0;"";"G")
Change $A$2:$A$100 to your range in sheet2

How to compare a list of rows to another list of rows in Excel?

I am trying to figure out if there are any differences between a list of data with another. In order for a row of data to "match" with another row, the row must have the same values in their corresponding column. The rows themselves do not have to be in any particular order. In particular, I am dealing with a parts list, where there are part numbers, descriptions, etc. I am trying to figure out if any rows of data are different from rows of data from another list.
I found Compare two sheets using arrays, which may have the answer to my problem, but I am having trouble figuring out how to adapt to my code due to inexperience in Visual Basic.
I was able to get it to work for a single column of data, comparing one column of data from one sheet to another, but cannot get it to compare entire rows of data.
Here is an example of I want this to work:
Sheet 1 Sheet 2
Column 1 Column 2 Column 1 Column 2
Row 1 22a 33 11 11
Row 2 22a 33a 22a 33
Row 3 55 22b 55 23b
The code in the link will tell you what is not in sheet 1 but in sheet 2 and vice versa. In this example, I would like the code to tell me Sheet 1 Row 2 and Sheet 1 Row 3 are not in Sheet 2, and Sheet 2 Row 1 and Sheet 2 Row 3 are not in Sheet 1 (Sheet 1 Row 1 and Sheet 2 Row 2 match).
If that is ok by you, you can do it without VBA using the following formula:
={IF(IFERROR(MATCH(A1&"|"&B1;Sheet7!$A$1:$A$3&"|"&Sheet7!$B$1:$B$3;0);-1)=-1;"Unique";"")}
Assuming that each of your tables start in A1 (so that the tables with three entries span A1:B3), and entering this formula into C1 (and copying it down), press CTRL+SHIFT+ENTER when entering the formula to create an array formula, this will show the word "Unique" in column C if the pair in that row on that sheet is not in any of the row-pairs on sheet 2.
You can then use conditional formatting to highlight unique rows, filter on the tables to include only unique rows, or some other way of doing what you need.
NOTE 1: I have entered my numbers in Sheet6 and Sheet7 instead of 1 and 2. The formula written above goes into Sheet6.
NOTE 2: My language use ; instead of , as function separator, so if yours use , you need to change that.
NOTE 3: You will need to expand the ranges Sheet7!$A$1:$A$3 and Sheet7!$B$1:$B$3 if your set grows (this will happen automatically if new rows are inserted in between the old ones). The best is still probably to create named ranges for each of the 4 columns, exchange the references with those, and manage the named ranges instead of the formulas.
NOTE 4: If your data set contains the character "|", you need to change that as well, to match some character that you for sure do not have there.
Alternatively you could in column C on each cheet enter (assuming first entry in C1)
=A1&"|"&B1"
and copy this down, then run the solution from your copied example using that C column instead of on A1 and B1.

Flag Data in Excel Programatially

I have two sheets in an excel workbook. One of the sheets has 8 ID numbers. The other sheet has about 5000 rows, not every row matches one of the ID numbers on the other sheet. I want to flag the rows where an ID number is an exact match to the other sheet and extract them to a separate sheet.
At the moment I was thinking I could just type in
=IF(A2=sheet2!b3,1,0) OR IF(A2=sheet2!b4,2,0) OR IF(A2=sheet2!b5,3,0) OR IF(A2=sheet2!b6,4,0) OR IF(A2=sheet2!b7,5,0) OR IF(A2=sheet2!b8,6,0) OR IF(A2=sheet2!b9,7,0) OR IF(A2=sheet2!b10,8,0)
Then copy and paste them to a separate sheet, but this doesn't work for some reason.
Any help would be much appreciated.
I didn't fix your formula for all the 8 ID's, but you should be able to add additional checks.
=IF(A2=$B$3;1; IF(A2=$B$4;2; IF(A2=$B$5;3;0)))
This basically reads as:
compare A2 with B3, if they match return 1 (note the use of $ sign in order to always use the B3 cell, this is called absolute cell reference)
if it doesn't match then compare A2 with B4 and if that matches return 2
if it doesn't match then compare A2 with B5 and if that matches return 3
if it doesn't match return 0
If you wish to compare to all 8 IDs you should just nest the if's a bit more.
A simpler solution would be to use VLOOKUP.