Excel FILTER/OFFSET Function - return array range based on multiple conditions? - excel-formula

I am working with the OFFSET function for the first time and I am using it as part of a larger FILTER function.
There is an "Invoice Number" column that has the invoice numbers, but due to the formatting of the report, it also includes the vendor's name for each vendor, as well as blanks. The length of the column and where the vendor names/blanks are varies depending on the number of invoices. The attached screenshot shows the formatting of the column and I have highlighted what I would like to return. enter image description here
So far, I have the below formula:
=FILTER(OFFSET(Sheet2!E10,0,0,ROWS(Sheet2!E:E)-ROW(Sheet2!E10)+1),OFFSET(Sheet2!E10,0,0,ROWS(Sheet2!E:E)-ROW(Sheet2!E10)+1)<>"")
This largely achieves what I want in that it returns an array that spills to the length of the Invoice Number column while removing any blanks. The end of the function tells the formula not to include any items that are blanks (<> ""). I would like it to also not include the vendor names, but it does not appear that I can use AND() within the OFFSET to add another condition. I thought about excluding anything that is not a number, but some of the invoice "numbers" are not actual numbers (e.g. 12345AB or 12345-1/17/23).
How can I adjust this formula to exclude blanks ("") as well as other items like vendor names? Is there an easier/more efficient way to do all of this?

Related

Index Match Formula returns a VALUE error is look up cell has several characters

I am puzzled by this problem.
I have a matrix with different criteria (shown below) which is to be used by users to access themselves, with each piece of criteria reflecting a maturity level. The criteria and the relevant maturity level is stored within a sheet called MasterSheetGrid.
The user selects the option that represents the criteria that they believe they are currently a like, in column J. Column K then performs the follow formula
=INDEX(MasterSheetGrid!$5:$5,MATCH((XLOOKUP($J8,$5:$5,8:8)),INDEX(MasterSheetGrid!$1:$50,((MATCH($C8,MasterSheetGrid!$C:$C,0))))))
This formula attempts to look at the user selection in column J, and calculates the criteria that their selection equates to. Then, using the criteria, the formula should look up the criteria within the MAsterSheetGrid and then return the corresponding level from row 5:5.
This formula works and does what i want it to, however, there are some instances where the formula does not work, when the look up/maturity criteria has a large amount of characters. I cannot work out how many characters this is, but the formula does not work if over a certain amount.
Note, i have attempted to replace the XLOOKUP with INDEXMATCH with no luck, i receive the same error. Also, the maturity criteria/user selection is calculated by the formula below
=IF($C8="","",(FILTER(INDEX(MasterSheetGrid!$D:$I,MATCH($C8,MasterSheetGrid!$C:$C,0),0),INDEX(MasterSheetGrid!$D:$I,MATCH($C8,MasterSheetGrid!$C:$C,0),0)<>"")))
MaturitySheetGrid
Formula works correctly due to a small character look up criteria
Formula does not work when the look up/selected criteria has a large amount of characters

Conditional formatting based on two quantity columns (Excel)

I'll try to be as specific as possible.
I want to compare an array of different codes (Quantity Needed). A column that contains the same code multiple times, and each of these needs to be compared to the value of a single cell in another column, that contains that code only once (Stock Qty).
To be more specific,I need to compare the quantity needed of said specific code (which is located in a cell next to the code) to the quantity in stock of said code (which is located in another table).
Then I need said 'Quantity Needed" cell to turn either Green (if the number on the Stock Qty column related to that specific code is equal or bigger than the number on the Quantity Needed cells for that code) or Red (If the number is less).
I could do this with conditionals one by one but the amount of codes is very large.
Image for further comprehension: https://snag.gy/EnzGWc.jpg
Thanks.
You can use conditional formatting with formula. goto conditional formatting=>New rule=>formula. There enter this formula =D3-VLOOKUP($B3,$H$3:$I$10000,2,FALSE)<0 . Set applies to =$D$3:$D$10000. Adjust range to fit all values in columns.

Return last date something was entered into one column with criteria from another column

I'm working with a set of data in excel. Data is entered into rows for items specified in columns. The first column contains a date. A cell in the same row of one of the columns contains the name of a person and in another cell in the same row but different column may contain a number larger than zero (or it may be empty).
I need to create a formula which returns the date when a number larger than zero was last entered into that column for a specific name. This is a "living list" which keeps on growing and the same names appear in different rows, sometimes with a number in the column a mentioned and sometimes not.
I found an old thread on this site on a similar subject which got me as far as knowing the date of the last entry containing the persons name but I'm still not able to configure it to show me when that specific person also had a number larger than zero in that column.
Here's the thread: How to get the newest value from a column with conditions
My current formula looks like this:
=INDEX($A:$A,MATCH(MAX(IF($G:$G=Sheet7!C5,$A:$A,0)),IF($G:$G=Sheet7!C5,$A:$A,"")))
CTRL+SHIFT+ENTER
Column A contains the dates
Column G contains the names (and "Sheet7!C5" is a reference to a name)
The value column I need to add to the mix is column AY
I feel there must be a simple solution (a small add on to the formula) to solve this but I always end up with an error.
Thanks in advance :)
Edit: Here is a simplified example of the data entry and output list needed.
For this you need to sort the date DESCENDING and format the table as Excel Table
Edit: you can sort the date ascending. See explanation at the end.
Using your example, then the formula will be
=INDEX(TableData[Activity A], MATCH($B14, TableData[Employee initials], 0))
This works just like the usual VLOOKUP or INDEX MATCH, fetching the first date on an activity matching the employee initials.
You can use VLOOKUP, but you'll need to dynamically name the range of each columns.
Edit: Just today I found an interesting behavior of MATCH when it found multiple matching values. If you use 1 instead of 0, then it will fetch the last matching value on the list.
So, you can use this formula instead in ASCENDING table.
=INDEX(TableData[Activity A], MATCH($B14, TableData[Employee initials], 1))

Show nth value in a list that matches specific criteria [EXCEL]

I would like to find the nth value in a list that matches specific criteria and have those values printed in separate places in separate worksheets.
More specifically I have a list of invoice numbers either beginning with a number or with PF and I want the first (or second, third etc) value beginning with PF to show on the Proforma Invoice worksheet, and the first (or second, third etc) value beginning with a number to show on the Invoice worksheet.
At the moment I have a selection of invoice numbers like so:
Invoice #
PF17-0982
43256
65342
96038
PF16-0934
10293
And I would like to print the nth value on this list matching the criteria I give, so either beginning in a number or beginning in PF, in a separate worksheet.
Initially I tried
=IF(LEFT('Top Sheet'!S5)="P",'Top Sheet'!S5,"")
which works to find the number beginning with PF but obviously only for the first cell in the list.
I also have
=IF(ISNUMBER(LEFT('Top Sheet'!S5)*1),'Top Sheet'!S5,"")
Which again works wonderfully for the first value in the list but not for much else.
So, naturally, I googled and tried using INDEX and MATCH and SEARCH functions as found here https://exceljet.net/formula/get-first-match-cell-contains but I don't want the output to be another list dependant on only one of the values in the invoice number list. However I don't mind having an intermediate list (e.g. list of TRUE and FALSE values) which will ultimately lead to me having a single output. I have this list at the moment which was done using:
=SUMPRODUCT(--ISNUMBER(SEARCH({"PF"},'Top Sheet'!S5)))>0
And that brings me here, I've tried various variations of the above techniques and failed hopelessly. I either get an error of some description or just TRUE and FALSE values. I hope this makes sense.
Another formula approach, with which you can enter the formula normally, is to use the AGGREGATE function to determine the row number within the array of invoices. With the SMALL operator, you can work on an array, ignore errors, and return multiple values.
If Invoices is a named range containing your list of invoices, then:
For invoices starting with PF
=IFERROR(INDEX(Invoices,AGGREGATE(15,6, 1/(LEFT(Invoices,2)="PF")*ROW(Invoices)-MIN(ROW(Invoices))+1,ROWS($1:1))),"")
For invoices starting with a digit
=IFERROR(INDEX(Invoices,AGGREGATE(15,6,1/ISNUMBER(-LEFT(Invoices,1)*ROW(Invoices))*ROW(Invoices)-MIN(ROW(Invoices))+1,ROWS($1:1))),"")
For either of these formulas, enter in some cell and fill down until the formula returns blanks. The ROWS... argument will increment and return the appropriate k for the SMALL function.
Another method would be to use a simple Filter, then copy/paste the visible cells to where you want.
Or you could use the Advanced Filter, which has a built-in method to paste the results to another location.
In order to extract multiple items from a list you can use the INDEX function with SMALL to create an array formula.
=IFERROR(INDEX($B$4:$B$9,SMALL(IF((ISNUMBER($B$4:$B$9)),ROW($B$4:$B$9)-3),ROW(1:1)),1),"")
IMPORTANT: use CTRL+SHIFT+ENTER when entering this formula to make it an array formula.
This formula takes the first numeric value from your list. If the formula is changed to ROW(2:2) it would select the 2nd numeric value from the list and you can autofill the formula down to extract as many as you like.
It's quite a complicated formula to follow but you first index a range "INDEX(B4:B9" then use SMALL with an if statement "(ISNUMBER(B4:B9)". Then define the first row of the source data "ROW(B4:B9)-3)" the minus 3 is because it's 3 rows from the top. Next the row that matches your criteria that you want to extract "ROW(1:1)" and last the column that contains the value that you want "),1"
I'm not the best person to explain this formula but there are some good tutorials online.
PivotTable alternative:
(optional) select the range of cells including the header "Invoice #" cell
Insert tab > PivotTable
make sure the header cell is included in the Table/Range: field
select Existing Worksheet and the Location range where you want the filtered list
on the PivotTable Field List that shows up on the right check the Invoice # field
on the sheet, in the Row Labels cell click on the triangle filter button and select Label Filters > Begins With... > PF
(optional) in the Design tab click Grand Totals > Off for Rows and Columns, uncheck Column Headers, and rename the Row Labels cell text if needed
For the numbers, you can copy the PivotTable and change the Label Filter to Less Than... > A
Whenever the source Invoice # range changes, you can click Refresh All on the Data tab for the PivotTables to refresh.

Locate duplicate information between two spreadsheets

I run an open order report for a warehouse team every two days, and then go through the open orders; and email vendors to confirm their delivery date as pointed out by the report.
Naturally the reports are going to have some of the same information every other day, but there will be new orders, as well.
What I need to be able to do is figure out a way to tell the new spreadsheet to determine if any of the information in the new sheet was in the old sheet.
For example.
A, B, C, D, is Delivery Date, Part Number, Part Description, and Purchase Order Number - Respectively.
Information in spreadsheets in internal and confidential, otherwise I would post a photo of it, to help understand.
I want it to tell me if those items match between both spreadsheets, so that I don't suddenly end up asking twice about an order or have to go line by line to match up. Because that takes FOREVER.
Assuming the purchase orders are unique day to day, you can use the match function in a column on the new orders page to see if the same PO is on the old PO's tab. If you get a #N/A the values are unique. Otherwise, Match will return the row number of the matching value.
If you need to match on multiple values (e.g. Date, PO, Part#) then use the concatenate formula to create a multi-part key.
=Concatenate(Text(DateCell, "YYYYMMDD"),"_", PO,"_", Part#)
Then put the same formula on both sheets and do the match on your new key column.
If you want to test for equality across all items, you can do it easily with an array formula. Here is an example that compares 4 columns (similar to you) for exact matches. It multiples the combined result by ROW so that you can see where the last match occurs. It is the last one because MAX is used.
Hopefully you can see how this would be extended to your case. Note that this is an array formula (entered with CTRL+SHIFT+ENTER) in cell F2 copied down through the column.
Formula in cell F2
=MAX((A2=$H$2:$H$21)*(B2=$I$2:$I$21)*(C2=$J$2:$J$21)*(D2=$K$2:$K$21)*ROW($H$2:$H$21))
This formula works by building up a product of comparisons which is the same as an AND operation. This will be a 1 if the conditions are all true. That 1 is then multiplied by the ROW so that the match location is returned.
Picture with a couple matching rows colored and the ranges in color to see how the formula works.

Resources