Close Window
Got an Excel Question?

Lottery Combinations

Hi, i have spent ages trying to write formulas that will generate all combinations of the lottery. Thats 6 numbers and a single bonus number; all ranging from 1 - 49. I do not wish to use VB or macros, but will have to if no other solution is possible. Ideally the individual numbers will be in seperate cells (eg: A1=1,A2=2..etc). Can anyone help?

- Ask any question about Excel and have it answered in no time.

Similar Excel Tutorials

Logical operators in VBA allow you to make decisions when certain conditions are met. They allow you to check if so ...

Helpful Excel Macros

- Generate a series of non-repeating random numbers in Excel with this UDF (user defined function). This is a great funct

- This free Excel macro formats selected cells in the Number or Numerical number format in Excel. This means that the cel

- This free Excel UDF allows you to get the numbers out of a cell that contain both text and numbers. This is a great fun

- This macro will highlight all of the cells in a worksheet which contain a formula. The first one listed will highlight

- This macro will change the formulas in cells to absolute or relative. It allows you to change the rows or the columns o

Similar Topics


I need to know the formula (if there is one) for Excel to figure all the possible combinations of a given set of numbers that will add up to a specified sum.

In other words, if I give the following numbers 1, 2, 2, 3, 3, 4, 5, 5, 6, 7, 7 - I want Excel to figure all the possible combinations that will add up to 23, and also SHOW ME those combinations, and not just HOW MANY combinations there are.

i.e. one possible combination is 2, 2, 3, 4, 5, 7

Can this be done? What is the formula? I'm having a hard time figuring it out!!


Hello gurus!

Here's my question...I have a list of numbers and I want to know how many combinations (and what they are) of adding the numbers will equal an amount.
List of Numbers

Amount to be reached = 12

These are some of the possible combinations to reach 12 :

Is there a function in Excel that will do this for me? I want to know which numbers (i.e. cells) can be added to reach 12. AND, if possible, colorcode the cells added for each combination.

Good luck and thanks!!

I want to create 6 numbers from 11 numbers..
lets suppose my numbers a 1,2,3,4,5,6,7,8,9,10,11
I want to generate all possibilities of the 6 numbers. But i dont want duplicate series.. I mean 1,2,3,4,5,6 and 6,5,4,3,2,1 are duplicates.


Is there a worksheet function that will generate all possible combinations of
a set of given numjbers. For example, 1, 3 and 8 would generate 138, 183,
318, 381, 813, 831 and so on...

Hi Forum,

Need help to generate Series of Items in different Permuation & Combinations..

For Ex:- If there are three Items.. A B C and forming a group of 2
then the the total no of combinations would be permut(3,1) = 6...

I need this to be shown as follows depending on the no of itmes and no of group no=2 in this case...

Permuations & Combinations are as follows:


I want to generate all possible combinations of 11 combination 4. I know there are 330 possible combinations but how can i let excel generate all the combinations. 1-11 combination 4.

For example. 1 2 3 4 5 6 7 8 9 10 11 taking 4 at a time:

I need a set of formulas to list all 120 permutations of the letters ABCDE, can anyone help?!

I'm trying to write a formula that will automatically take a group of football (soccer) scores, compare them with a set of predictions, and then allocate points according to how close the predictions are to the actual scores.

Manchester United 3 - 0 Arsenal
Prediction: 4 - 1
Points: 1

I've found a formula online that works for most scores; the correct score (e.g. 3 - 0), a correct win (e.g. 4 - 1), and in the case of a draw (e.g Man Utd 1 - 1 Arsenal, and the prediction 2 -2), correct draw (but not the correct score). The points are as follows: Correct draw (Prediction = result): 4 Correct win (Prediction = result): 3 Correct win, incorrect score (Winner correct, score not): 1 Correct draw, incorrect sco 1

The formula I found online for all but the correct draw is: =IF(A3&B3=C3&D3),3,IF(AND(A3=B3,C3=D3),1,IF(AND(A3>B3,C3>D3),1,IF(AND(A3<B3,C3<D3),1,0)))))

Could someone help me work out how I can write a formula to add before the above that will check the contents of four cells (the home score, away score, home prediction, away prediction), and if the number in all 4 cells are the same, allocate 4 points? I've tried using averages, but some combinations would void this. I've also used the SUM function, but the same happens, as with MULTIPLYING.

Something like =IF(A3:D3) are equal, 4,0

Below are a few examples of what I mean:
(Result) (Prediction) (Points)
3 - 3 3 - 3 4
2 - 1 3 - 1 1
1 - 0 1 - 0 3
3 - 3 2 - 2 1

Apologies in advance if I haven't explained this clearly enough.



Hello everyone, I am new to this forum and have been using excel for about 3 years. I have learned alot but still can not figure out how to make numbers add up in one box like a running total. Meaning, If I have a list and in the list is one cell for each item say like cell a1 is for a can of coke and cell a2 is for a car tire and so on,and i want to keep a running total by adding a number to cell a1 or a2 like say "3 i.e. 3 tires or cans of coke" and later that day i come back and need to add 2 more i want to be able to just click on the cell a1 or a2 and enter the number 2 and the cell would add the number in it to the number im adding to it to show a result of 5 tires or whatever. I am sorry If i am not asking the question in an understandable manor but its the best way I can think to ask anyways, any help would be appreciated, Thanks in advance.


Is it possible to have numbers added to the same cell and have excel continue
to calculate the addition for me in that same cell......ex: I have the number
8 in cell d2 and I want to add the number 8 to that cell and have excel add
the 8 to the previous 8 for a total of 16 in the same cell.....the next time
I would add 5, and the total would be 21? Can this be done in a single cell?

Hi there, I have a string of numbers and I would like to add zeros to the end of it.

For example my numbers are formatted like this: 1234 and I would like to add zeros to the end so it looks like this: 123400 (no decimal).

I would do it manually but I have a column of over 2000 different numbers.

Thanks for your help, you guys are great!

dear supervirsor
i would like to know how to change english numbers to arabic number on excel
, where when i change the language from english to arabic the numbers didnt
changed it still in english


I'm a bit of a newbie with Excel, but...

I have several cells with data that contain both letters and numbers (4H, 8V, 4FH, etc.) What I want to do is remove only the text characters from these cells, and add the remaining number values together among a series of cells with this data type.

If your answer involves using a macro or VB, please provide a link on how to use the formula. I've never used a macro or VB.


Hi folks,

Hoping someone can help me quickly as I'm pulling my hair out and have a deadline getting too close.

Been trailing the net and this board but can't work out how to do a simple variance.

How do I work out the difference between two numbers - including negatives.

If the numbers are all positive, it's fine as it's simply a case of A - B = C which is your difference. However, that doesn't work if B is negative.

I need a formula that would give the following:

First Number / Second Number / Difference
1 / 5 / 4
1 / -5 / -6
-1 / 5 / 6
-1 / -5 / -4
-5 / -1 / 4

Hopefully there's a simple function I've been missing.

Thanks in advance, R

Dear Sirs,

Am in need for this solution very badly and what could be a better place than excelforum !

I have an MS Excel File (2007 version) sample file attached, which has name, designation, blood group and so on. The last column is for hyperlinking photographs of individuals.

In the same folder where I have saved this excel file, are lying photographs of individuals. While scanning the photographs, I have saved them serially i.e. 1,2,3 and so on.

In the Excel file, in last column, I have given the respective serial numbers. In order to hyperlink one has to select that particular Cell, press Ctrl K and you automatically go to the folder containing individual photographs, you select that photo and OK.

Problem :

I have to do this hyperlinking one by one and if there 1000 photos, lot of time is wasted.

Solution Needed :

Just in case of excel formula, which we copy and paste, Can I get a command by virtue of which the column titled Photo or column next to it gets automatically Hyperlinked to respective photo WHEN I copy and paste such command to all cells in that column.

Thanks a million and warm regards ::: Jack

i've been trying to figure this out on my own but seem to be hitting road blocks.

i have a column of numbers that we extracted from a database as whole numbers. for instance, 30 should be .30 and 100 should be 1.00. when i try to increase or decrease the decimal point it doesn't allow me to convert it to those positions.

would any one have a tip of how i can easily convert this? there are over 2000 entries in my excel spreadsheet so to do it manually would take a lot of time/effort.

thank you!

I need help writing a formula to add a column of numbers until a value is reached, then start over adding numbers starting at the next cell after the value is reached.

Thanks for any help.


In excel, I tried to convert numbers to number format, using
format/cells/number from the category list. But it won't take, and stays
text-like. Any ideas?


I am new to using Excel and I am not very computer literate. I am looking for some help with a spreadsheet I am making. Here is the problem:

I have a column of 14 numbers in cells A1 to A14. If all of these values are less than 2%, I would like a "Pass" to display in cell B1. If any of these values are greater than 2% I would like a "Fail" to display in cell B1.

I have got a formula that works for a single cell but I can't figure out how to get it to apply to more than one cell. For example, I have entered =IF(A1<2,"Pass","Fail") in cell B1. Now if the value I enter in A1 is less than 2, it shows a "Pass", and if the value in A1 is greater than 2 it shows a "Fail" in cell B1. How can I get this to apply to all of the cells from A1 to A14?

If somebody could help me out that would be great.


I saw two threads in this forum that asked this question, with no good answer. I am posting this solution for anybody still struggling with this.

The question:
How can you prevent a cell's contents from overflowing into the next cell?

Of course, you can make the column wider or turn on text wrapping, but you might not want to. Each of those solutions can mess up the layout of your sheet. You may just want to truncate the value.

Some people have suggested putting a space in the next cell. This is unnecessary, a pain in the but, and will mess up any ISBLANK type formulas, among other things.

The solution:
Select the cells in question and turn on text wrapping (Format>Cells>Alignment>Wrap Text).
Now select the row(s) in question and manually set the row height, by right clicking the row number and selecting "Row Height". Check the height of an adjacent row for a good value.

Your cells will now not spill over either horizontally or vertically. They will simply truncate anything that doesn't fit.

Be careful now, because parts of your data may be hidden. This can cause its own set of problems if one or two digits are neatly hidden away. Think ahead if other people might be using this sheet, and not be expecting to have some data hidden.

Tested in Excel 2002

I know this question has been asked a bajillion times, so I apologize for the redundancy.

I am working with an Excel spreadsheet and saving it as a .csv file in order to upload to an application that parses out the .csv data as transactions. The system requires .csv files, so this is how I need to save my doc (with this extension). I have been successful at preventing Excel from coverting that long number into scientific format. I have saved as a TXT file, pasted the longer number and it displays correctly. That is all good. But I have to save as a .csv. So if I do that, close the Excel window, and then open again (as the .csv file), the numbers are back to being displayed in scientific format. I have tried creating an Excel doc from scratch and entering text in Text format, to see if this created a cleaner file. But again, the second I save as .csv, close the window and then open that file up again, that dang scientific format is back.

Does anyone have any idea of how to work around this? Once I have successfully gotten the numbers to display as the long-chain number, how can I get them to "stick" so that they don't revert back to scientific format when I reopen the file?

Thanks so much for your help!

Right now I have a sports league with 8 teams, I'd like to create a random 7-game schedule where each team plays the other team only once. Essentially this will be a 7-game round robin. However, I'd like to be able to use this for any number of teams and games.

I'd like to do this in Excel, but I can't figure out how to have a randomly generating non-repeating macro with text values in cells.

So right now I have a column of 8 values and need matrix of 7 columns by 8 rows next to it.

I've found this thread that has one for numbers, but I can't figure out how to do it for text values...

/ />
Thanks all!

I have never really used VBA and so am completely stuck at this problem. I need to create a macro which auto-populates a master worksheet from the individual user sheets in a shared workbook.

Sheet 1 is the master sheet "Team Stats". There will be an undetermined number of individual worksheets to accomodate new staff.

Each worksheet will be identical, using columns A-I with row 1 having the headings:

Date, Name, Reference, Value, Price, Age, Purchased?, Destination, Add. Products (the last 3 columns will have a drop-down list which will be used to enter data into the cell).

There will be a varying number of rows in each of the individual sheets.

If possible I would like the macro to run every time data is entered into one of the individual worksheets. If this is not then it would be fien to update every time the workbook is opened.

If anyone can help it would really cut down the time I spend collating these stats every day!

Hi All,

I am trying to make excel automatically add a leading zero to values which are 5 digits long;

i.e. number input is 15185, then excel automatically changes it to 015185.

If I put a Customer Number Format of 0##### it works, however, a user could put any length of number into these cells, and if the number is less than 5 digits I don't want a leading zero.

Is there any way of writing a small macro to sort this out.

The numbers would be input into range B16:223.

Many thanks,


I have AplphaNumeric part numbers that sometimes contain hyphens or decimals. In order to make them more searchable (since people don't always use the hyphens or decimals properly when they search) I would like to create all the possible variants of the part number, but with one formula.

So AHW18.787 becomes AHW18 787 and AHW18787 with

=SUBSTITUTE(A1,"."," ") and
=SUBSTITUTE(A1,".","") respectively, and

AHRTW-A18-7007 becomes AHRTW A18 7007 and AHRTWA187007 with

=SUBSTITUTE(A1,"-"," ") and

What I need to be able to do is merge these formulas into one, so that no matter what format the part number is in A1, I get a version of it with spaces in B1, and a version of it with no spaces in C1. I just have not been able to nest it all together - is it even possible with this command?


Related pages

fedex dimensional weight calculatormicrosoft vbscript regular expressions 5.5vba getsaveasfilenameunprotect sheet commandmultiple rows in one cell excelerror handling excel vbaemployee vacation calendar templatemscal.ocx office 2013excel formula to highlight duplicatesequals vbamax formula in excelunhide rows in excelword ole actiongenerate kml from excelexcel forgot password to unprotect sheetvba automation errorhow to open xlsbexcel budget formulasmacro excel insert rowexcel remove charactersinsert hyperlink in excelunencrypt excel fileexcel pivot calculated fieldhow to calculate deflation rateexcel round downundo scroll lock in excel8.00 am cst to istinputbox accesstimestamp in excelgoal seek vbaaverageifs excelcalculate compound interest excelabsolute value excel 2010prize fund calculatorsupply demand curve excelleap year calculationsexcel graph scaleconvert prn filespellnumbersedolswhat does too many different cell formats mean in excelsecond derivative calculatorautofilter vba excelvba selected rangehow do i unhide cells in excelkeyboard shortcut for wrap textexcel progress indicatorvba code to close a formexcel vba timevalueoffset formula excelexcel count by cell colorexcel macro autofill705 pt cardexcel vba functions tutorialrun time error 1004 in vbavehicle mileage log excelexcel auto fill textvb error 438how to read a tape measure in decimalsround to the nearest dollar in excelduplicate rows in excelexcel function for subtractiondecile calculatorhow do you create a checkbox in excelhow to hide formula in excel sheetlinear extrapolation excelpmt in excellock fields in excelew betting calculatornormality test in excelpayroll sheet in excelwage slip templatexlk file extensionexcel nested functionweekly staff rota templateseparating first and last names in excelhighlight active cell in excel