Understanding a Code

Excel_77

Active Member
Joined
Sep 15, 2016
Messages
311
Office Version
  1. 2019
Platform
  1. Windows
I'm working on a file that has the following code, can anybody explain what it does please?

=if(coutifs(c:\Storage\[file]\tab1'!$a$3:$a$2600,$a44,c:\Storage\[file]tab1'!$y$3:$y$2689,"*"&mid(n$27,5,100)&"*")>0,"yes","no")
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Put this formula in any cell on the same sheet:

="*"&MID(N$27,5,100)&"*" (A)

and this formula in another cell

=$A44 (B)


Your formula is checking to see if
BOTH
value A is found in range A3:A2600 (in tab1 of the other file)
AND
value B is found in range Y3:Y2689 (in tab1 of the other file)


If BOTH are found THEN your formula returns "yes" OTHERWISE returns "no"
 
Last edited:
Upvote 0
That should be COUNTIFS and you've left out a couple of single quotes

It returns Yes if...

the value of A44 equals a value in "c:\Storage\[file]\tab1'!$a$3:$a$2600"
AND
N27 from the 5th character to the 104th character appears anywhere within a cell in "c:\Storage\[file]tab1'!$y$3:$y$2689"

otherwise No is returned
 
Upvote 0
The asterisk is a wildcard, so let's say mid(n$27,5,100) evaluates as the word "test", your criterion is *test* which means that anything containing the text "test" (wihout quotes) will be counted.
 
Last edited:
Upvote 0
wildcards allow some more flexibility
* is a wildcard (any number of characters)
? is a single character widcard

Cell A1 contains value "CDEF"

this formula fails to find a match
=MATCH("CD",A1,0)

these formuas find a match
=MATCH("CD"&"*",A1,0)
=MATCH("CD" & "??",A1,0)
=MATCH("CD" & "?" &"F",A1,0)
=MATCH("CD"&"*"&"F",A1,0)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,905
Messages
6,175,297
Members
452,633
Latest member
DougMo

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