Using XLOOKUP or INDEX and MATCH with IF statement

Adamfm00

New Member
Joined
Nov 24, 2022
Messages
7
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have been through a number of tutorials about using XLOOKUP, INDEX and MATCH but I can't get the syntax right, was hoping someone could help? Thanks

What I trying to do is: If the "Material" column is "Metal" match the number in the "Sold ID No" with the "Part No" column and display the value in the "Price" column in Sold Price

Part NoToyPriceMaterialSold ID NoSold Price
10001Scateboard$10Plastic10003If Material = "Metal" what is the Price
10002Bike$100Metal10002
10003Train$120Plastic10001
10004Car$50Metal
10005Airplane$75Metal
10006Rocket$60Plastic
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Hi & welcome to MrExcel.
What should happen for the IDs that are not metal?
 
Upvote 0
Ok, how about
Fluff.xlsm
ABCDEFGH
1Part NoToyPriceMaterialSold ID NoSold Price
210001Scateboard10Plastic100030
310002Bike100Metal10002100
410003Train120Plastic100010
510004Car50Metal
610005Airplane75Metal
710006Rocket60Plastic
Main
Cell Formulas
RangeFormula
H2:H4H2=FILTER($C$2:$C$7,($A$2:$A$7=G2)*($D$2:$D$7="metal"),0)
 
Upvote 0
Thanks Fluff :)
Sorry, one thing I forgot is that Column G needs to be an array as I only want to know the value if it is one of the numbers in G.
 
Upvote 0
Sorry but I don't understand, that formula only looks for the values in col G
 
Upvote 0
Yes sorry, I was trying to recreate what I was trying to do but it should be like below as I need prices against the list on the left but only for the numbers in the array on the right.

Part NoToyPriceMaterialSold PriceSold ID No
10001Scateboard$10PlasticIf Material = "Metal" what is the Price10003
10002Bike$100Metal?10002
10003Train$120Plastic?10001
10004Car$50Metal?
10005Airplane$75Metal?
10006Rocket$60Plastic?
 
Upvote 0
How about
Fluff.xlsm
ABCDEFG
1Part NoToyPriceMaterialSold ID No
210001Scateboard10Plastic010003
310002Bike100Metal10010002
410003Train120Plastic010001
510004Car50Metal0
610005Airplane75Metal0
710006Rocket60Plastic0
Main
Cell Formulas
RangeFormula
E2:E7E2=IF(AND(D2="metal",ISNUMBER(XMATCH(A2,$G$2:$G$4))),C2,0)
 
Upvote 0
Solution
Hi Fluff, plugged it into my file but it doesn't like it, saying inconsistent formula. I followed it and chose a line that should spit out a value but it's just putting out zero for some reason?

=IF(AND(C7722="Planned Maintenance", ISNUMBER(XMATCH(A7722,$K$2:$K$84))),H7722,0)
 
Upvote 0
Check that you don't have any circular references.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top