# Finding Prime Numbers In A Range And Highlighting It

Oct 28, 2013How can I find prime numbers in a range and highlight it if a number in a cell is a prime.

View 9 RepliesHow can I find prime numbers in a range and highlight it if a number in a cell is a prime.

View 9 RepliesADVERTISEMENT

So I have multiple columns of numerical data,

I have to find the sum of all numbers between 10 and 40 within a column, NOT cell 10 to 40 but the actual number 10 and 40.

How do I do that?

Is it SUMIF? I cannt seem to grasp this.

how to go about finding sequences and highlighting them.

here's an example list:

7600

7601

7602

7603

7604

7608

7609

7610

7611

now i need to find 3 things in this list.

1) how many 'batches' of sequences there are in this list. The numbers 7600 to 7604 are a consecutive sequence of five numbers followed by another sequence from 7608 to 7611. that makes two sequences. i need a formula for one cell that would specify how many sequences there are in a given list (in this case they're two sequences in this list).

2) is there any formula that can allow me to see each sequence highlighted in a different color (or any way to differentiate the sequences so i can copy paste them easily?). Pretty sure i'd have to use conditional formating on the entire list to do so but am clueless as to the implementation.

3) a formula for a single cell that can state the largest sequence in the list. in the list above the largest seuqnce is 5 numbers so that would be the value i'm looking for.

I have two columns that is use to record last name first name. I need a macro that will find matching names in the columns. i have found some examples for searching one column but have not had any luck finding someway to do 2 columns. in the example below i need it to find and highlight The names Smith John.

View 3 Replies View RelatedI want to have Excel highlight one or two numbers/cells in one column based on the value in another cell. I am attempting to do this using Conditional Formatting.

For example, if X1 is BETWEEN A2 and A3, I want to highlight A2 AND A3. I have used various AND and IF functions to achieve this goal.

Also, if X1 is EQUAL to A2, I want A2 to be highlighted. This is easy to do with a simple formula.

But my problem is this: if X1 is equal to A2, I want ONLY A2 highlighted. If X1 is between A2 and A3, I want BOTH A2 and A3 highlighted. I cannot figure out how to achieve both. For example, when X1 = A3, A2 AND A3 are being highlighted, instead of just A3. I would prefer to do this without a macro, if possible. Can this be done?

Example formulas I have tried which easily achieve the highlighting of two cells when the value is between them:

Condition 1=IF(AND($I$35>I8,$I$35<I7),1," ")+IF($I$35<>I7,1," ")

Condition 2=IF(AND($I$35<I6,$I$35>I8),1," ")+IF($I$35<>I7,1," ")

It appears that the +IF, etc. functions are not doing anything.

This is more complicated by the fact that the value of, in the above example, I35 is based on a value from another sheet (I used a function to transfer a value from one sheet to I35 in the other sheet). As data are entered on Sheet1, the value in I35 in Sheet2 changes.

I have been trying to write two formulas in one cell. I have been able to write them both separately but have been unable to join them both together. What I am trying to do if first search name them how many reoccurring numbers appear. I have provided an example below

a b c d

1 Tom 333

2 Sam 22

3 Sam 22

4 John 5

5 Sam 22

6 Sam 1

7 Tom 3

8 Tom 333

So the answer would be

Tom = 2

Sam = 2

John = 1

I work for a charity and I have to cancel the donations of people whose credit card donations have been declined in three consecutive months.

If in Column A I have a list of donor IDs whose credit cards were declined in Jan 2008, in Column B I have a list of donor IDs whose credit cards were declined in Feb 2008 and in Column C I have a list of donor IDs whose credit cards were declined in Mar 2008, is there a way of showing in a fourth column which donor IDs were common (repeated) in Columns A, B and C? I would have a title for each column in A1, B1 and C1, and also the column where the repeated donor IDs would be displayed.

I found this spreadsheet on here and I have been trying to customize it to what I need. I am trying to have scores from skins match highlighted. I want only the minimum score to be highlighted but if there is another duplicate minimum score I don't want it to highlight anything. I also need to find a way to count the skins won by each player and have it off to the side.

For those not familiar with golf a Skin is a game where you try to get the lowest amount of strokes on a specific hole. Ex- 4 people play the hole one. P1 scores 4, P2 gets a 3, P3 and P4 get 6. The skin would go to P2 who has the lowest score on that hole.

Highlight lowest number in each column not highlighting if there are duplicates starting at L6 down to L11 and for each column till AC. And the same for the group just to the right on attached file.

On row 13 and 14 it tells me who won a skin. I want to tally up the total skins won by each player. so if Joe's names shows up twice on R14 I want it to tell me somewhere in the sheet Joe = 2

Is there any formula witch i can use to find the smallest prime factor of a number?

Example: In A1 i write 30 (30=2*3*5 (the prime factors))

in B1 i write a formula, and the result will be 2 (smallest prime factor)

What is the formula?

Searching through the forums, I've found a post of daddylonglegs, witch shows how to find the smallest factor of a number:

View 7 Replies View RelatedI have one report that cannot include some special characters so I replace them with empty space. I need also to exclude symbol double prime ( " ). Below is my code, but third line is wrong of course three double primes in a row (two to define text and one is symbol I want to remove), VBA doesn't recognize it. So how could I define that this program also replaces " with space.

Code:

Sheets("Stavke").Range("C2:C" & LR).Replace What:="+", Replacement:=" ", LookAt:=xlPart

Sheets("Stavke").Range("C2:C" & LR).Replace What:="#", Replacement:=" ", LookAt:=xlPart

Sheets("Stavke").Range("C2:C" & LR).Replace What:=""", Replacement:=" ", LookAt:=xlPart

What is the line of code in VBA that allows me to highlight a range of cells (in a column) to the end of the range? e.g. Selection is A2, highlight to end of range in column A. I know this is simple, but I'm new to VBA. Unsuccessful searching the posts.

View 2 Replies View RelatedI have a worksheet 200+ rows with 7 columns (euro lottery numbers) I had great help last night to highlight any matching numbers. I'm getting lazy now, can anyone help with a formula to highlight a cell in an adjacent column when 2 or more numbers in the corresponding cells match the winning numbers, I know all I have to do is look down the columns and check but if a simple formula could be inserted it would save me perhaps missing something.

View 14 Replies View RelatedI have a file in which I have data from A9:I50.

In the column C i have the type mentioned either MTC or SELF.

If the value in column C is SELF then I want to highlight the corresponding rows from A:I.

[Code] ......

This code is colouring the entire row.

I want it to be highlighted from A to I.

I am using this Formula =Sum(Offset(A1,,,D1)) where I put for example number 4 in D1 and I get the sum starting cell A1 till Cell A4

I want the range to be highlighted as well, but I don't know how to do it.

I have a column that needs to be text format, but it needs to include only digits (0-9), no letters, no special characters. Also all cells need to have 7 digits.

I am trying to do a couple of things:

1 : Hightlight the cells that contain Strings with Non-Digits characters

2 : Highlight the cells with less than 7 characters (I have the code, it is below)

I have tried many ways to get #1 but I am stuck.

Help please.

This highlights the cells with less than 7 characters:

Sub StringLength3() ' IT WORKS!

Dim strTest As String

Dim i As Integer

Dim Cell As Range

'Select Range

Worksheets("tres").Activate

Worksheets("tres").Range("A2", Range("a65536").End(xlUp)).Name = "RangeA"

Range("RangeA").Select

For Each Rangea In Selection

i = Len(Rangea)

If i 7 Then

Rangea.Cells.Interior.ColorIndex = 7

End If

Next Rangea

End Sub

Is there a function in excel that can look at an array of values and find the two values that equal a number.

I have a number 159. I have an array of 100 numbers but only two of them added together can equal 159. Rather than sort through every possible combination is there a function in excel that can do that?

I have another post here on this forum, but I'm afaid the formula is getting so complex that nobody is able to fully understand what I want. Instead I want to find a value between two numbers and add it to some IF sentences. It will do what I want, even if it's not that elegant.

I've looked at the SUMIF function but it did not do exactly what I wanted. It finds a number or adds numbers only if they are in range it seems.

What I want is the following:

Return sum between 500 and 1000 in one cell.

Create a form where i would enter 2 numbers into 2 seperate boxes, and those numbers would be highlighted/bolded/shown in red from a list of 30 rows of numbers x 20 numbers in each row. these 2 numbers will not be the same all the time, below is just for an example

ie. number: ... (5) number: ... (59)

1 28 19 20 5 9 80 72 12 38 50 53 59 83 ...

8 4 38 29 11 39 27 38 3 49 59 80 13 12 49 4 5 ...

and so on....

....

So picture something like that, but with 30 rows of numbers x 20 numbers in each row.

I have a large list of numbers in two columns. I need to know what numbers are in column A but don't appear in column B. For example if the numbers are 1 2 and 3 in column A but column B only has 1 and 2 I need to know that 3 is missing.

the only thing I can think of is doing =IF(A1=B1,"TRUE","FALSE") however typing this a thousand times would not be practical.

Is there a macro that can check column A against column B and tell me which ones are missing?

Find smallest numbers in the range ignoring zeros.

I want it returned as value "1", all others - as value "0".

Example: range A1:J1 contains - 5,0,7,3,6,5,8,0,9,3

desirable result in the range A2:J2 - 0,0,0,1,0,0,0,0,0,1

I am trying to find numbers from a string. I have for example words "EUR Fwd 9x12" and "Eur Fwd 11x15" And i want to write a function that reads the first number from a string if there is only one number before "x" or two numbers if there are 2 numbers. So I have tried to build following function:

Function NumbersInString(Word As String) As Integer

Dim i As Integer

Dim FirstNumberInString As Integer, SecondNumberInString As Integer

For i = 1 To Len(Word)

If IsNumeric(Mid(Word, i, 1)) Then

FirstNumberInString = Mid(Word, i, 1)

If IsNumeric(Mid(Word, i + 1, 1)) = False Then

Exit Function

Else

SecondNumberInString = Mid(Word, i + 1, 1)

End If

End If

Next

NumbersInString = FirstNumberInString & SecondNumberInString

End Function

I am looking for a way to find a highest (and/or) lowest value in a list of numbers. The list keeps getting longer and after a certain point I will need the 2 highest (or lowest), then the 3 highest (or lowest). I know MIN and MAX will find the high and low, but how do I find the 2nd highest, etc?

View 3 Replies View RelatedI am trying to get an average of a couple numbers, but I have to enter both numbers in one cell.

I have to enter the numbers in a cell as a range (ex. "1000-3000"). I need to convey it as a range in the spreadsheet I am doing, but in a separate cell I need the average of the extremes (1000 & 3000). Is there a formula or anything that would let me get the average of those two numbers(2000) directly from that one cell? If needed, I could make the cell "1000,3000" instead. I just don't want to make two separate cells, one saying 1000 and the other saying 3000.

I do a lot of work in excel to do with accounts and this often needs checking against sage. When the invoices/petty cash sheets are put into sage the total amount is put in, but in my spreadsheets I need to split the reciepts. So I was wondering if there was a formula/VBA code, that if I only knew the total of the invoice would find which cells added up to this total?

View 4 Replies View RelatedIn a data report i have a column which contains a mix of text and may contain an 8 digit number which could start in 0.

for example

in column A i could have "Hello how are you 01237232 I am fine"

I wish to extract the number into a seperate column, and would ordinarilly use a mid or left/ right function, however the text infront and behind the number will vary in length, which means i cannot do this.

The number will always be 8 digits, could start in 0 but will not always, and it may not be present in all the cells in this column.

How I an achieve this?

How I can know the numbers of rows and columns in a excel sheet?

View 5 Replies View RelatedI have an excel file which contains two sheets. In one sheet there are some numbers in a single column. In the other sheet again there are certain numbers span across rows and columns (a number may be duplicated). I need to check whether there are numbers which exist in both the sheets. If such a number is found it may be marked (say with a color) in both the sheets.

View 2 Replies View RelatedI have got the following issue. I have got a large list of values in a column. I need to detect the the ones which are in non-consecutive order and display the difference in single numbers. For example:

1 fine

2 fine

3 fine

7 - 4,5,6

10 - 8,9

In other words I need to find the missing values and get them displayed.

I am building an inventory simulation and have run into a problem. What i want is, when i change a number in cell H4, i want excel to find the sum of C25 and the cells "H4" up. If H4 is 5 then i need the sum of C20:C25...if H4 is 10 i need C15:C25. Does anyone have any thoughts on how to do this? I have attached a sample sheet to make it more clear.

View 2 Replies View Related
Copyrights 2005-15 www.BigResource.com, All rights reserved