I'm struggling to format a VLOOKUP to work the way I need it to. #N/A's are all over the place.
I'm probably using something entirely incorrectly and not as intended.
I have the following data:
Windows Version Table - AA2:AD3450
Hardware Model Column - P2:P85
Accepted SKU - M2:M55
Client Name - Sheet1 Cell A2:A9000
Client Model - Shee1 Cell J2:J9000
Client Area - Sheet1 Cell B2:B9000
Client OS - Sheet1 Cell E2:E9000
I need to identify the following
I hope this makes a little sense. Ive been trying to figure this one out for a while.
Data Ref Table:
Client Information Table
Expected output
Requirement: Validate records in lo.DATA
table against lo.Clients
table and output valid
and invalid
records in two separated tables lo.Ok
and lo.Error
.
Note: A valid record must have Client OS
= 7
as per OP.
lo.DATA
table, located at [B11:F21]
and lo.Clients
table, located at [H11:M15]
VLOOKUP function : This function has limitations when it comes to the use of criteria, therefore I suggest to use it only for straight matches. We'll use this function in the tables lo.Ok
and lo.Error
to return the associated values once the record compliance have been identified.
Criteria:
Client OS:
= lo.DATA[@[Client OS]] = 7
Client OS must be 7 as per OP (change as required).
MATCH function : Use this function to validate record compliance of Model & SKU.
Client Model:
= MATCH( lo.DATA[Client Model], lo.Clients[Model], 0 )
SKU:
= MATCH( lo.DATA[SKU], lo.Clients[SKU], 0 )
Multiple Criteria:
Formula:
= ( ( lo.DATA[Client OS] = 7 )
* ( MATCH( lo.DATA[Client Model], lo.Clients[Model], 0 ) > 0 )
* ( MATCH( lo.DATA[SKU], lo.Clients[SKU], 0 ) > 0 ) )
AGGREGATE function : Use this function to return a list of the valid\invalid records after applying the corresponding multiple criteria.
Use the Array form
of the function AGGREGATE(function_num, options, array, [k])
, were:
AGGREGATE function parameters:
function_num
= 15
(SMALL)
options
= 6
(Ignore error values)
array
=
( ( lo.DATA[Client OS] = 7 )
* ( MATCH( lo.DATA[Client Model], lo.Clients[Model], 0 ) > 0 )
* ( MATCH( lo.DATA[SKU], lo.Clients[SKU], 0 ) > 0 ) )’
[k]
= ROWS([Col$Row:ColRow)
( ROWS function ColRow
= Address of the 1st cell where the formula is entered, ie ROWS(W$12:W12)
)
This is the resulting formula:
= AGGREGATE( 15, 6,
( ( lo.DATA[Client OS] = 7 )
* ( MATCH( lo.DATA[Client Model], lo.Clients[Model], 0 ) > 0 )
* ( MATCH( lo.DATA[SKU], lo.Clients[SKU], 0 ) > 0 ) ),
ROWS(W$12:W12) )
Although the AGGREGATE function returns the valid record, it misses the position of the records. To obtain the position use the ROW function
ROW (Col:Col)
(ie Col= Column where the formula is entered)
This is the resulting formula:
= AGGREGATE( 15, 6,
ROW(AA:AA) / ( ( lo.DATA[Client OS] = 7 )
* ( MATCH( lo.DATA[Client Model], lo.Clients[Model], 0 ) > 0 )
* ( MATCH( lo.DATA[SKU], lo.Clients[SKU], 0 ) > 0 ) ),
ROWS(AA$12:AA12) )
MULTI-CRITERIA Formula
Finally, use the INDEX function to return the corresponding record from the `lo.DATA' table.
= IFERROR( INDEX( lo.DATA[Client Name], AGGREGATE( 15, 6,
ROW(AC:AC) / ( ( lo.DATA[Client OS] = 7 )
* ( MATCH( lo.DATA[Client Model], lo.Clients[Model], 0 ) > 0 )
* ( MATCH( lo.DATA[SKU], lo.Clients[SKU], 0 ) > 0 ) ),
ROWS(AC$12:AC12) ) ), "" )
Proposed Solution: Please ensure the consistency of the headers among the tables, this is key for the VLOOKUP
formulas to return the correct values.
Valid record in table lo.Ok
, located at [AL11:AP21]
Formulas
Client Name:
= IFERROR( INDEX( lo.DATA[Client Name], AGGREGATE( 15, 6,
ROW(AL:AL) / ( ( lo.DATA[Client OS] = 7 )
* ( MATCH( lo.DATA[Client Model], lo.Clients[Model], 0 ) > 0 )
* ( MATCH( lo.DATA[SKU], lo.Clients[SKU], 0 ) > 0 ) ),
ROWS(AL$12:AL12) ) ), "" )
Client Model, Client Area, SKU,Client OS:
Enter this formula in [AM12]
then copy to [AM12:AP21]
= IFERROR( VLOOKUP( [@[Client Name]], lo.DATA25,
MATCH( AM$11, lo.DATA[#Headers], 0 ), 0 ), "" )
Invalid record in table lo.Error
, located at [AT11:AY21]
Formulas
Client Name:
The validation is performed against the lo.Ok
table, (ie a record from lo.DATA
is invalid
if it is not found
in lo.Ok
).
= IFERROR( INDEX( lo.DATA[Client Name], AGGREGATE( 15, 6,
ROW(AT:AT) / ISERROR( MATCH( lo.DATA[Client Name], Lo.OK[Client Name], 0 ) ),
ROWS(AT$12:AT12) ) ), "" )
Client Model, Client Area, SKU, Client OS:
Enter this formula in [AU12]
then copy to [AX12:AP21]
= IFERROR( VLOOKUP( [@[Client Name]], lo.DATA,
MATCH( AU$11, lo.DATA[#Headers], 0 ), 0 ), "" )
Status:
= IF( LEN([@[Client Name]])=0, "",
SUBSTITUTE( CONCATENATE( "Error in: ,",
IF( [@[Client OS]] <> 7, ", OS", "" ),
IF( ISERROR( MATCH( [Client Model], lo.Clients.A[Model], 0 ) ), ", Model", "" ),
IF( ISERROR( MATCH( [SKU], lo.Clients.A[SKU], 0 ) ), ", SKU", "" ) ), ",,", "" ) )
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.