How to do an operation on a range inside of a formula

tagout

New Member
Joined
Apr 19, 2021
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Is there a way to perform an operation on a range as part of another formula? I have a column of text. I want to search that column to see four characters match the last four characters of any cell in the range. So, my formula would look something like this: =COUNTIF( RIGHT(A1:A8, 4), "ABCD") This gives me an error.

Now, I know that I can create another column and use the RIGHT formula to get the last 4 characters and then search that column. However, I am wondering if there is a way to do the search without creating a new column.

Thanks for any help,
 

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
Hi,

Use this:

Excel Formula:
=COUNTIF(A1:A8,"*ABCD")
 
Upvote 0
Hi,

Use this:

Excel Formula:
=COUNTIF(A1:A8,"*ABCD")
Hi Jtakw
That is a good answer, but I should have complicated my question a bit more. What if what I want check is the last four characters of another text value.

=COUNTIF(LEFT(A1:A8,4), LEFT(B1,4))
 
Upvote 0
Is it Left or Right, you switched.

Book3.xlsx
ABC
12abcdxyz
2
3abcdtext
4
5abctext
6abcdabc
7
8
Sheet913
Cell Formulas
RangeFormula
B1B1=COUNTIF(A1:A8,LEFT(C1,4)&"*")
 
Upvote 0
Solution
Is it Left or Right, you switched.

Book3.xlsx
ABC
12abcdxyz
2
3abcdtext
4
5abctext
6abcdabc
7
8
Sheet913
Cell Formulas
RangeFormula
B1B1=COUNTIF(A1:A8,LEFT(C1,4)&"*")
Mr. jtakw,
Thank you. That is exactly what I need. You 'da man. :)
 
Upvote 0
You're welcome, thanks for the feedback.

Don't forget to mark the post that solved your question as solution. Thanks.
 
Upvote 0
Mr. jtakw,
Thank you. That is exactly what I need. You 'da man. :)
Sorry, I did switch. I want right but kept thinking left. Still, I was able to figure out what you were doing and make it work for right.
 
Upvote 0
Sorry, I did switch. I want right but kept thinking left. Still, I was able to figure out what you were doing and make it work for right.

Just in case:

Book3.xlsx
ABC
12xyzabcd
2
3textabcd
4
5textabc
6abcabcd
Sheet913
Cell Formulas
RangeFormula
B1B1=COUNTIF(A1:A8,"*"&RIGHT(C1,4))
 
Upvote 0

Forum statistics

Threads
1,214,523
Messages
6,120,028
Members
448,940
Latest member
mdusw

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