item
countDate
shopID
lineNumber
defectNumber
jobID
jobID2
123A1234-123
1/1/2022
1234
1
123A1234-123
1/2/2022
1234
2
123A1234-123-AB123
1/1/2022
AB12C
1234
0
IP-0000123456
IP-000ABC0123
1/1/2022
AB12C
1234
1
IP-000ABC0123
Above is an example of the type of data I usually get, limited to only those fields that are relevant.
As you can see there are three instances of item 123A1234-123, 2 of which have no Job ID. I am trying to find a way to fill those blank spaces with the Job ID from the defect number 0 instance of the item.
The problem I am encountering is that the item code is longer on that instance. There is also the fact that listings in the item field are of several different formats, though they are mostly uniform in in format for the ones I am trying to fix.
Previous attempts at building an equation to fill the new column jobID2 result in value errors.
[#jobID2] = INDEX([jobID],MATCH(1,[countDate]=[#countDate])*([lineNumber]=[#lineNumber])*([item]=LEFT([#item],SEARCH(CHAR(164), SUBSTITUTE([#item],"-",CHAR(164),2))-1)),0))
This equation was written before I found an example in the data that didn't share the same count date.
I had help writing this but that person never replied to my follow up questions.
From what I can work out it is supposed to replace the second - with a special character and then search for that special character before returning the jobID. I think the problem is partially that not all the data matches this format, but I'm not that versed in using LEFT(SEARCH(
I am running Excel 2013 on a (8gb ram, windows 10 enterprise 64 bit, 3.1GHZ i5) machine. I've killed it a couple of times trying to run big equations on some of the data sheets so I'm unsure how complex the equation or script can be.
Any help I can get is very much appreciated.
Edit:
Current state of the equation, returns N/A on all data entries.
[#jobID2] =INDEX([jobID],MATCH(1,(([#[defectNumber]] = 0)*([lineNumber]=[#lineNumber])*(LEFT([#item],12)=LEFT([item],12))),0))
The problem I am seeing now is that
it doesn't return a row number, match just spits out 1 aka true
it doesn't look like each row is searching the whole database, just its own row
Looked up a different formula
[#jobID2] = VLOOKUP(1,CHOOSE({1,2},(LEFT([#item],12)=LEFT([item],12))*([#lineNumber]=[lineNumber])*(""<>[shopID]),[shopID]),2,0)
This returns n/a for all entries except for the ones where shopID <> 0 where it returns a 0
So... progress
Related
I have a sheet that pulls metrics regarding employees from an internal source, I am trying to create an end of day report card and would like to display the names in ranking order based upon the metrics.
a small example for demonstration:
Columns A and B: An example of the kind of data in my sheet.
column D: I have used a variation of
=INDEX(A$2:A$6,MATCH(E2,B$2:B$6,0))
Column E:
=LARGE(B$2:B$6,1)
as you can see I am running into trouble with duplicate 'total' values creating an incorrect index number causing the first name that matches to be the result.
column G i have attempted to get around this by using:
=INDEX(A$16:A$20,MATCH(E19,B$16:B$20,0)+COUNTIF(B$16:B$20,E19)-1)
to attempt to account for the duplicates by adding a countif to the index number, of course, is an incorrect approach.
Not shown I also tried adding 0.5/'employee id number' to the total (0.5/an integer gives me a decimal between 0 and 0.5 allowing me to have each number be unique without causing any rounding problems to the displayed total. However, I think the decimal was ignored by the MATCH and it made no effect.
A weird problem has had me puzzled and I appreciate any help!
Have you tried something like this
=INDEX($A$2:$A$6,AGGREGATE(15,6,(ROW($A$2:$A$6)-ROW($A$2)+1)/($E2=$B$2:$B$6),COUNTIF($E$2:E2,E2)))
=INDEX($A$9:$A$13,AGGREGATE(15,6,(ROW($A$9:$A$13)-ROW($A$9)+1)/($E9=$B$9:$B$13),COUNTIF($E$9:E9,E9)))
=INDEX($A$16:$A$20,AGGREGATE(15,6,(ROW($A$16:$A$20)-ROW($A$16)+1)/($E16=$B$16:$B$20),COUNTIF($E$16:E16,E16)))
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
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))
I have a table which is something like this:
Customer ID | Review Flag | Date Received
London Official 27-May-14
London Official 29-May-14
Reginald Official 29-May-14
Reginald Official 29-May-14
Townie Official 05-Jun-14
FHAR_L Unofficial 05-Jun-14
Reginald Official 10-Jun-14
Akmed Official 10-Jun-14
PALNEES Unofficial 11-Jun-14
Akmed Official 11-Jun-14
Woody Official 11-Jun-14
Woody Official 11-Jun-14
Sarah Official 11-Jun-14
I want to count the number of unique official cases over the last 2 weeks. So for example, the result for this particular table would be 5 cases and not 7.
My current implementation is to construct a pivot table, put the customer ID as the row and the value then run a count function on the value column as the ouput. The problem with this is the user needs to go in and change the filters on the pivot table every day, which can get quite confusing because we don't get a case everyday. For example, as some months have 31 days, a situation arises where if we don't receive a case on the 31st then we should not count cases received on the 30th when we are on the 13th of the next month. So ideally, I'd like this solution to be formula-based.
I've read alot about counting uniques in excel but they all seem to be confusing and complicated. Also, they seem to be based off a condition which makes it incompatible with COUNTIFS, which is the function I should use when trying to take into account 'review flag = official' and 'date range = cell1 < x <= cell2'.
Of course, I can do this in VBA but I was wondering if there is a formula-based solution available.
I've worked it out using the SUM(1/COUNTIFS(...)) method of counting unique items in a list.
The formula I got was: =SUM(IF(("Official"=R18:R1000)*(D18:D1000>TODAY()-14),1/COUNTIFS(R18:R100,"Official",C18:C1000,C18:C1000,D18:D1000,">"&TODAY()-14)),0)
Where column names R = review flag, D = date received, C = customer ID, and the dataset starts at row 18.
How I think this works: We have a left hand side array (the IF array) and the right hand side array (the COUNTIFS) array. The COUNTIFS array finds out the number of occurences each binding happens, i.e. at array row[10] it would ask "how many times does the 'Woody, Official, 11-Jun-14' appear together?". The left hand side array looks at which rows match our targetted conditions, returning true or false each row. The SUM function then adds up all the rows in the right hand side array where the left hand side array says that that particular row is TRUE, but as we did 1/ earlier we would get each binding summing up to only 1, thus simulating a unique.
An Important Thing to Remember:
When using array formulas, make sure that all your arrays are of the same size, otherwise you will get an error.
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.