Need Assistance With Formula Creation

meppwc

Well-known Member
Joined
May 16, 2003
Messages
626
Office Version
  1. 365
Platform
  1. Windows
I would appreciate assistance with a formula.

This formula will reside in cell C2 of the “Asset List” worksheet.
Search on cell A2, and then on cell B2 of the “Asset List”
Search in worksheet “Equipment” in column G
If only A2 is found, then, “MSN FOUND”
If only B2 is found, then, “CSN FOUND”
If A2 and B2 are both found, then, “BOTH FOUND”
If nothing found, then, “NOTHING FOUND”
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Please try this:
=LET(a,COUNTIF(G:G,A2),b,COUNTIF(G:G,B2),IFS(AND(a>0,b>0),"BOTH FOUND",a>0,"MSN FOUND",b>0,"CSN FOUND",a+b=0,"NOTHING FOUND"))
 
Upvote 0
Another to try
Excel Formula:
=LET(G,Equipment!G:G,CHOOSE(IFNA((MATCH(A2,G,0)>0),0)+2*IFNA((MATCH(B2,G,0)>0),0)+1,"NOTHING","MSN","CSN","BOTH")&" FOUND")
 
Upvote 0
Jeffrey. Thank you. I did notice that I am getting incorrect results when one of the values being searched on is a blank cell. I can get around it by changing G:G to G2:G10238, which excluded the blank cells that have data in them. But I was wondering if there is a simpler way around that so that I don't have to keep changing the column length as my data contineously changes.
 
Upvote 0
Another to try
Excel Formula:
=LET(G,Equipment!G:G,CHOOSE(IFNA((MATCH(A2,G,0)>0),0)+2*IFNA((MATCH(B2,G,0)>0),0)+1,"NOTHING","MSN","CSN","BOTH")&" FOUND")[/COThank
[/QUOTE]
Did you try the other suggestion?
That did not work. All cells provide the same result."NOTHING"
 
Last edited by a moderator:
Upvote 0
Jeffrey. Thank you. I did notice that I am getting incorrect results when one of the values being searched on is a blank cell. I can get around it by changing G:G to G2:G10238, which excluded the blank cells that have data in them. But I was wondering if there is a simpler way around that so that I don't have to keep changing the column length as my data contineously changes.
Yeah, You can create a Dynamic named range. I use them for everything. If the Data in column starts in row 2 then the formula for the range would be:
=Offset($G$1,1,0,match("zzzzzzzzzzzzz",$G:$G,1)-row($G$1),1)
This will adjust itself based on the values in the column. NAme it want you want and change the other formula accordingly
 
Upvote 0
Yeah, You can create a Dynamic named range. I use them for everything. If the Data in column starts in row 2 then the formula for the range would be:
=Offset($G$1,1,0,match("zzzzzzzzzzzzz",$G:$G,1)-row($G$1),1)
This will adjust itself based on the values in the column. NAme it want you want and change the other formula accordingly
Great, thanks............I have never done that before so I will work with it soon, when time permits
 
Upvote 0
That did not work. All cells provide the same result."NOTHING"
In that case it sounds like either the description was mis-interpreted or the data is not quite as it seems it should be.
Here is my sample data and results. Is this what you would expect? Certainly the results are not all "Nothing"
Perhaps you could provide some small sample data from the two sheets with XL2BB as I have done and then we can test with your data.
meppwc.xlsm
ABCDEFG
1
2a
3b
4c
5d
6
Equipment


Cell Formulas
RangeFormula
C2:C10C2=LET(G,Equipment!G:G,CHOOSE(IFNA((MATCH(A2,G,0)>0),0)+2*IFNA((MATCH(B2,G,0)>0),0)+1,"NOTHING","MSN","CSN","BOTH")&" FOUND")
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,996
Members
452,373
Latest member
TimReeks

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