Understanding a Code

Excel_77

Active Member
Joined
Sep 15, 2016
Messages
306
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

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
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,216,752
Messages
6,132,512
Members
449,731
Latest member
dasda34

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