How to select cells with a single digit only, which digit is also in cells with multiple digits

mrwul62

Board Regular
Joined
Jan 3, 2016
Messages
61
Office Version
  1. 365
Platform
  1. Windows
Example:
I would like to select cells that contains a 5 only
However cells with, for instance, 15 or 450 or 325 or game 115 should not be selected

same goes for:
I would like to select cells that contains -5- only
Cells with 15, 450 etc. like above should not be selected.

Any suggestions?

Many thanks!
 
Last edited:

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
1. Are the cells all in a single column? (Which column?)

2. Are you wanting to do this manually or by a macro?

3. If by macro, what do you want to select them for? That is, what are you going to do next with those cells? I ask because you rarely need to select cells in vba to work with them and selecting slows your code.
 
Upvote 0
Do you want to do this with code or a formula?
 
Upvote 0
Do you want to do this with code or a formula?

Thanks for the quick response.

Sorry, I am afraid my question is/was incomplete.

It is within a range. I believe the usual selection does not offer a method of selecting such cells.
The '5' in my first post could be any digit from 1 to and incl. 10 (or -1- to -10-)
i.e. select all cells within a range that matches 10 or -10- but not 100 or 110

Am far from an expert, sorry.

Maybe it can be done using a formula?

I don't know - you folks here are the experts...:)

Thanks.
 
Upvote 0
Maybe it can be done using a formula?
A formula cannot 'select' cells.

Since you didn't specifically answer my question about manual/macro or what you subsequently want to do with the cells, see if this manual method is any use to you.

1. Select the range in question (or the entire sheet by clicking the box at the top left of the sheet where columns labels and row labels intersect if that is relevant for you)
2. Ctrl+F to bring up the 'Find' dialog
3. Find what: 5
4. Expand the dialog with the Options>> button, enter a check mark in "Match entire cell contents" and ensure the 'Look in:' drop-down has 'Values' selected.
5. Click Find All and on the keyboard Ctrl+A and 'click 'Close' on the Find dialog
 
Upvote 0
Super!

That is what I was looking for. I wasn't really aware of the he extra options within Find and specifically the 'Match entire cell contents->Values' and subsequent select all (ctrl-a).
Instead I was trying to figure out this same thing but then within 'Select' (instead of find).

I just want to mark those cells (color).

Many thanks indeed!
Truly appreciate the detailed steps.

p.s. whilst using above method, I tried to figure out whether it would be possible to search on multiple values,
using '|' or ';' , but think it is not possible, or better said, it is only possible using a 3rd party add-on.
 
Upvote 0
Super!

That is what I was looking for.

Truly appreciate the detailed steps.
You're welcome. :)


I just want to mark those cells (color).

p.s. whilst using above method, I tried to figure out whether it would be possible to search on multiple values,
using '|' or ';' , but think it is not possible, or better said, it is only possible using a 3rd party add-on.
You are right, you cannot simultaneously find multiple values this way.
However, since what you are trying to do is colour the cells, you could use Conditional Formatting - which does allow for dealing with multiple values.
 
Upvote 0
I think the first option works out best for me.
The below is a small piece of a larger Excelsheet and shows what I wanted.
BTW: seems to me that it should be too complicated for Microsoft to implement booleans(OR -or- AND)?

Anyway, this matter is solved. Wouldn't have figured this out myself.
Thank you again.


 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
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