If match found yes/ no, two different tables, two different values - excel

I did not see something like this in other questions/ forums so hopefully it can be done.
Need to know if values from one table are in another, checking to see if there is a match.
Table 1 in Sheet 1 is used to record "Incoming" data of Part Number and Lot Number.
Table 2 in Sheet 2 is used to record when record is "Outgoing".
Column A is Part Number, B is Lot number in both Sheets. Part number can repeat, but Lot # will not. Trying to find a way to return a Yes/ No or 1,0 if part number and lot number in Sheet 1 exists in Sheet 2 in Column C of Sheet1. I have attached a Snippet example what I am trying to do. This will help me generate info on if an Incoming record has been completed and left (Outgoing). I do not believe vlookup will work and have tried some different permutations of match. Open for other options. Thanks!!
Edit: Lot # does have to ablity to repeat (not often) but with a different corresponding Part Number. Need to know if there is a match with both Lot# and Part Number as in the Incoming record.

Use:
=--(COUNTIFS(Sheet2!A:A,A2,Sheet2!B:B,B2)>0)
If there are matches it will return 1 if not 0

Related

Count Matches in an Array, Duplicates Once

I have an array with a number of columns but am looking to count based on two columns in particular. I'm looking to have a function that will count how many blank products (column C) are in production (Column B). See image below, the desired output here would be 2 (111 and 333 are in production. 111 appears twice but should be counted only once).
Case Example Image
I'm sure there is a better way to do this, but this will get the job done.
=COUNT(UNIQUE(C1:C4*--(B1:B4="In Production")))-1

What to use: COUNTIF or Vlookup or combined or else?

I got a big data file where I have to count how many events is per one serial number (in my case P/N) through more sheets (years). Those serials are in Column A (grey). On second picture is lookup table, so the data from where I have to search and Count events looking at (Column O - yellow) and Column A (artikel), using terms from Column P for all the sheets, I mean through different year. All sheets are consistent and looking exact the same.
What I tried to do is: COUNTIFS(A2:A142;VLOOKUP(A2;'Spareparts 2015'!$A$2:$O$164;15;FALSE))+COUNTIF('Spareparts 2015'!O2:O164;"Ersatz im Rahmen einer Wartung") to look for specific term but this is not what I wanted.
Idea is to get all these specific "terms" using P/N through all years (summed), to see how many times serial number (P/N) has been used through years. And I need total number (of 5 years). As you see in main table there are more serials, and everything what is needed is some good positioned function which I cant get...
Hopefully I was clear with my issue, it is a bit hard to explain, but I eager to provide more infos!
UPDATE!
This is actually what I wanted to accomplish (with Pivots is possible)
For every Serial (artikel) that I have in Calculated sheet, I wanna look and count all instances (Grund fur ersatz in Column O) through years and different sheets. Every sheet has mixed serials, and these occurrences, so I have to couple them with main table and to count total number of them, how many times something from Column O appeared in some of Serials through 5 years.
One option is using Pivot tables actually, but I wanted to know how I can solve it with formulas also.
EDIT #2
Given that the relationship between each serial number and the look up term is 'Many to Many' but not 'One to One', one way to count the occurrence of each term for each serial number is to
Firstly put all 5 years of data into one big table, and name the following ranges:
Name_All being names in Column O of the master data table;
SN_All being serial numbers in Column A of the master data table.
Secondly, create a look up sheet to list all serial numbers and associated look up terms as shown below:
Then you can use COUNTIFS to count the occurrence for each term per serial number:
=COUNTIFS(SN_All,A2,Name_All,B2)
See following screen-shot for more clarifications.
A better/quicker approach would be using pivot table as being mentioned by OP.

Creating an Index(Match()) for Multiple Criteria, with Multiple Results for Multiple Dates

The solution to this problem has been evading me and admittedly hurting my brain a little bit, so hopefully someone here can lend a hand. Essentially, I have around 10 columns of data. One of these columns contains the identifier I want to use, another column has the date I want to reference, and the rest of the columns are the values I want to use to populate the table. What I'm trying to do is build a tool where you type in the identifier and the date and it tells you what the other columns are for that particular pairing.
The problem is, however, that the data set contains multiple repeated dates (dates are in a column), and sometimes repeated identifiers. So identifier 1 may appear three times on 1/1/2018, then appear three more times on 1/2/2018.
Forgive my inexperience, as this is probably the incorrect way to show this, but this is what I want my data to look like, with the bins being the 1st, 2nd, and so on occurrences of the same identifier on the given date:
Identifier - A1
Date - 1/1/2018
Bin Column1 Column2 Column3 Column4
1 1 2 3 4
2 1 2 3 4
3
4
5
The Identifier and Date would be manual entries and the rest of the table would be automatically populated. I've been looking up different ways of using index(match()) all morning and have yet to achieve any success. I'm not sure if I'm approaching this incorrectly or what, but any help with this problem is greatly appreciated.
PS - I understand that a pivot table would likely give me the information I need, however, this table isn't for my own use, so I'm trying to make it as straightforward as possible (enter two lines, necessary info pops up).
Edit - This is how the data is currently set up:
`
Use this:
=IFERROR(INDEX(C:C,AGGREGATE(15,7,ROW($B$2:INDEX($B:$B,MATCH("zzz",$A:$A)))/(($B$2:INDEX($B:$B,MATCH("zzz",$A:$A))=$J$2)*($A$2:INDEX($A:$A,MATCH("zzz",$A:$A))=$J$1)),ROW(1:1))),"")
Note: realize this is an array formula that is entered normally with Enter, but as an array formula it will slow down the calcs if the dataset is large.
It generally looks like:
=INDEX('range all of the data, not the headers', MATCH('row header value to match','the row headers range',0), MATCH('column header to match','the column headers range',0))

Break-Down Data in Excel without VBA (Formula Only)

Many times, I am required to provide some type of break-down to the customers - an example is shown in the attached figure.
I have a table of data ("TABLE DATA" - which is some type of pivot) + Customer provides its official form, its structure must be preserved (highlighted in yellow ). Basically, I need to separate the cost details of CODE "A" and CODE "B" into 2 separated sections.
Customer requires me to provided details for each individual Part (example shows Part A - "Break-Down Part A)
Is there anyway to put a"ITEM" from "TABLE DATA" into Code A and Code B ? the rests can be solved by Vlookup (Price, Quantity) - note: "ITEM" is non-duplicated values . Thank you very much
Number your rows in the breakout using =1 and =A1+1 and then just use the formula ="B-ITEM"&TEXT(A1,"000"). If you want to skip making a counter column you could use ="B-ITEM"&TEXT(ROW()-1,"000") to just use the current row number (minus 1 or however many you need).
If your items aren't sequentially like that, but still unique, I would recommend adding counters on the original tab similar to what you have, which would let you quickly find the 5th A or 7th B, something that counts the previous instances of your current type, and then adds 1. For Row 6 you could do =COUNTIF(A$1:A5,A6)+1.

Excel: How to parse/cast text as a formula?

Is it possible to parse/cast text (like "=A1+A2") as a formula in MS Excel? I want to build a formula from pieces of text - some of which will only be typed in later by a user.
If the INDIRECT() function did not only work for referencing cells, then I could have typed this =INDIRECT("=A1+A2").
I know you can a work around this problem by simply adding a lot more hidden columns to do sub calculations. But for the sake scalability and efficiency, I would rather do something like the above.
I found a similar questions here and here, yet they don't solve my problem.
The Real-world problem:
Read on for a better understanding as to why you would want to do the above
Scenario
Each item in the list consists of a string, which contains anywhere from 1 to 5 account names each. Each account name is followed by an account number in brackets. The length of the number determines the type of account. Part of the account number is a date, of which the date format depends on the type of account. Further more, each account type may have more that 1 account-number length associated with it, although each number-length[*] is only associated with 1 account type.
Objectives
Extract account-names and their respective account-numbers and account-types from a list.
Make an assumption as to the account-type from the account-number
Validate this assumption by inspecting the build of the number and elements in the name
Check the validity of the account-numbers depending on their type.
The tricky part (this is where my problem lies)
The account-types and their respective account-number-lengths are not known before hand, and are typed into a table by the user of the sheet, specifying a type of account and the number-lengths associated with this account-type. The user should type this into a list - not go and tinker around with delicate formulas
Done so far
Column A: Contains the raw data (each cell has up to 5 names and numbers)
Columns B..F: Each column extracts 1 name, remains empty if all are already extracted
Columns G..K: Each column extracts 1 number corresponding to its name in columns B..F, remains empty if all are already extracted
Columns L..P: Each column calculates the length of the corresponding number in columns
G..K
Now the user would type the following details into a table which assigns certain number-lengths an account type:
TYPE2, BUSINESS, (OR(length=13,length=6))
where length will later be replaced with the cell address which contains the calculated account number-length.
What I want to do now
Columns Q..U:
Should all indicate the account-type of the corresponding account-number in columns G..K. The idea is to build a nested if-elseIf-elseIf formula using the criteria typed in by the user as specified above. Example of one of the elseIF statements:
SUBSTITUTE(CONCATENATE("=IF(",criteria,",",type,",",errCode)),"length","O10"))
All of these elseIf statements will then be concatenated together to form a master formula which will then need to be parsed/cast as a formula to calculate the account-type
This proposal uses only 5 columns (1 for each account-number, containing the master formula) and a table specifying account-types and criteria, also keeping the user away from formulas. Editing 1 line of code (the criteria) will update all formulas. Efficient & Scalable.
Since the user should never tinker around with the formulas under the hood, a simple 1 column if-elseIf-elseIf is out of the question. The alternative to the above would be to make a separate column to test for each account-type for each account-number. Separating/Abstracting out each test to its own column results in much better readability, easier editing & much less debugging - Unless you like multi-screen-wide-formulas. Example: 5 account-numbers * 10 possible account types = 50 extra columns.
Each edit to any criteria needs to copied to 4 other non-adjacent columns and drag-filled down 10,000 rows (columns can not be adjacent since it is effectively a 5x5 array of columns). Not Efficient nor scalable. Unless I'm missing some elegant way of updating non-adjacent formulas in a single click
The rest of the validations error indications are trivial.
Sample data
Tshepo Trust (6901/2005) Marlene Mead (8602250646085)
Great Force Inv 67 Pty Ltd (200602258007)
Jane (870811) Livingstone (6901/2005) Janette Appel (8503250647056) James (900111)
I know all this would probably be much easier to achieve with clever usage of VBA, eliminating all the need to simulate abstraction, encapsulation, multi-dimensional arrays and functional programming on a spreadsheet. But until I can program in VBA, worksheet formulas will be my refuge.
[*]: account number-length could also be described as the amount of digits in the number or as indicated by this formula: LEN(accNumber)
In VBA you have access to Cell.Formula.
I usually used Range to peek a cell by address.
I'm not sure if this would answer your question(it's a very detailed question!), but if your user was entering the account numbers in a table (I'm calling it 'RefTable') , that was:
Length of account number | business type
----------------------------------------
6 | Accountant
8 | Advisor
Then you could just use a vlookup on the length of the account number, given you've already separated them out.
=vlookup(len(accNumber), Reftable, 2, false)
Make sure that you either use a dynamic range name, or specify plenty of space below in RefTable, so that when your users add types, they don't get lost.
Also, if you have two different accounts with the same length, this could get you into trouble.

Resources