w.a.n.t formula

JOJO2730

New Member
Joined
Dec 20, 2022
Messages
8
Office Version
  1. 365
Platform
  1. Windows
I have a column as NOTES that contains data such as
01-feb-2022 text text text
w. text date text
a.text date text
n. text date text
t. text date text
basically, w.a.n.t. are the stages the note is written for.

I want a formula to check if w.a.n.t. is present in the cell.
There are some other formats to write w.a.n.t. such as W-A.N't. I want to run a formula through the text present in each cell of the column and check if w.a.n.t is present in all acceptable formats and return pass if present and fail otherwise
 
if ther is always a space - then try
=AND(SUM(COUNTIF(A1,{"*W: *","*W- *","*W. *"})),SUM(COUNTIF(A1,{"*A: *","*A- *","*A. *"})),SUM(COUNTIF(A1,{"*N: *","*N- *","*N. *"})),SUM(COUNTIF(A1,{"*T: *","*T- *","*T. *"})))
update the
{"*W: *","*W- *","*W. *"}
with any other possible types of entry for each letter

you can then add other letters S and X by adding to the AND

I'm sure there is a better way to do this - other members may have
Absolutely a better way... I never thought the formula could be this simple !!
Thanks!
 
Upvote 0

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
:( Unfortunately I didn't ever get an answer to ..
If w.a.n.t. does occur in the cell would it always be in that particular order (as they are in the two examples that you have given)?
If the answer is "Yes, they would always be in that order", then another approach could be to employ a user-defined function like this.
One thing about it is that if those characters that can follow w a n t change, it just needs the 'Const' line edited in the same pattern as below to add/remove items.

VBA Code:
Function WANT(s As String) As Boolean
  Const CanFollow As String = " : - ." '<-Edit as required. Put a space before ech one
  
  With CreateObject("VBScript.RegExp")
    .Ignorecase = True
    .Pattern = Replace("W# .*?A# .*?N# .*?T# .*?", "#", "[" & Replace(CanFollow, " ", "\") & "]")
    WANT = .Test(s)
  End With
End Function

The UDF would be used as in column B below.

If you do want to stick with a worksheet formula then you could try this (column C) modification of @etaf's idea. It is a bit more efficient and again easier to maintain any changes the the 'following' characters by only needing to edit them in one place near the beginning of the formula.

JOJO2730.xlsm
ABC
111-Feb-2022 - chasing client via email A: They paid 26/01 9.12300 we asked for the restN: 'ljhdudnh@hdgdh.com''lock.med@gmial.com'T: awaiting customers replyFALSEFALSE
211-Feb-2022 W- chasing client via email A: They paid 26/01 9.12300 we asked for the restN: 'ljhdudnh@hdgdh.com''lock.med@gmial.com'T: awaiting customers replyTRUETRUE
311-Feb-2022 W- chasing client via email A: They paid 26/01 9.12300 we asked for the restN: 'ljhdudnh@hdgdh.com''lock.med@gmial.comFALSEFALSE
411-Feb-2022 W- chasing client via email A. They paid 26/01 9.12300 we asked for the restN- 'ljhdudnh@hdgdh.com''lockt.med@gmial.com'T: awaiting customers replyTRUETRUE
Sheet1
Cell Formulas
RangeFormula
B1:B4B1=WANT(A1)
C1:C4C1=LET(x,{":","-","."}&"*",AND(OR(COUNTIF(A1,"*W"&x)),OR(COUNTIF(A1,"*A"&x)),OR(COUNTIF(A1,"*N"&x)),OR(COUNTIF(A1,"*T"&x))))
 
Upvote 0
Absolutely a better way... I never thought the formula could be this simple !!
Thanks!
Hello i have an addition to make with WANT there's PD. And QD.
there's no alternate format for PD. and QD.
What edits to make in the same formula??
 
Upvote 0
What edits to make in the same formula??
Not the same formula, but does this do what you want?
Excel Formula:
=LET(x,{":","-","."}&"*",AND(OR(COUNTIF(A1,"*W"&x)),OR(COUNTIF(A1,"*A"&x)),OR(COUNTIF(A1,"*N"&x)),OR(COUNTIF(A1,"*T"&x)),COUNTIF(A1,"*PD.*"),COUNTIF(A1,"*QD.*")))
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,021
Latest member
Justyna P

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