How To Write Series Of Number In Excel - excel

I want to write numbers in excel starting from 000001 till 999999
I have done like this =TEXT(A2,"000001") but i am not been able to generate series even though not able to separate this in different attributes
Further I want to distribute each number in each different cell for example like this
A B C D E F G
000001 0 0 0 0 0 1
000002 0 0 0 0 0 2
till
999999 9 9 9 9 9 9

Use following formuls to B1 cell and drag then right and down as needed.
=MID($A1,COLUMNS($A$1:A$1),1)
See the screenshot.

Here is a better way:
In cell A1, type 1.
Select A1 and from Home tab, choose Fill > Series (top-right).
Choose Columns; Linear; set Step Value to 1 and Stop Value to 999999 or whatever you want. Click OK.
Use AutoFill feature to fill up to the number you want.
Right-click column A header and choose Format Cells.
Choose Custom formatting and type 000000 in the custom format type textbox.
Click OK. Your cells will now show 000001, 000002, ... and so on.
In cell B1, type the following formula:
=INT(MOD($A1/(POWER(10, 7- COLUMN())), 10))
Copy B1 to columns C1 through G1.
Copy range B1:G1 to all subsequent rows B2:G999999 or whatever.
Notes
One advantage of this approach is that column A is numeric, not text, so you can enter any 6-digit (or less) integer in it directly from keyboard and the cells will update themselves correctly.
Column A will adjust number of leading zeros automatically for 6-digits or smaller numbers.
The formula simply divides the number in column A by 10, 100, 1000 and so on and then takes remainder by 10, to get the corresponding digit at that decimal place.
You can easily modify this formula to work with larger or smaller numbers. You simply need to replace 7 by (maximum number of digits in your number + 1).

Might be a bit easier with a VBA macro. Right-click the sheet tab, select View Code, paste the below code, and Run (F5)
Sub fill()
[a1:a999999] = "=text(row(), ""000000"")"
[b1:g999999] = "=mid($a1, column()-1, 1)"
End Sub

(Write this formula in Column A and extend it down to row 999999)
generating the series:
=RIGHT(10^6, 6-LEN(ROW(A1)))&ROW(A1)
Write this formula in Column B and extend it to Column G, then
extend the range of B1:G1 to B999999:G999999
Distributing digits
=MID($A1,COLUMN(A1),1)

Related

Input data into a 2nd cell, based on the value of a 3rd cell? (Like "conditional formatting")

B1 is a checkbox. If checked B1=1. A1 can range from 0 to 10. If B1 is checked I want A1 to automatically = 10. Exactly like conditional formatting would turn it green. I cant put the formula =IF(B1=1,10,"") into A1 though because I need to be able to input other values in A1 without erasing the formula. I need to be able to reuse the sheet multiple times.
Ex.
A B
1 10 x
2 9
3 10 x
4 4
As Scott commented, you'd need to use VBA to do exactly what you're asking. A work-around, though, would be to add a third column with:
=IF(B1="x",10,A1)
In this case, Column A would be the user-inputted number, Column B would be your "x", and Column C would give the final output: 10 if B has "x", and the number from A otherwise.

Populating Excel table using 2 cell coordinates - lots of data

I need your help with this problem I'm facing using Excel. Basically I need to populate a table, or better, a given group of cells (dimensions 3x3), and my starting point is:
row numb. column name. value
2 A 10
3 C 4
4 B 20
so I would need to obtain a group of cell like this:
1 A B C
2 10 0 0
3 0 0 4
4 0 20 0
where the cells that have no value can be 0 or whatever. In other words, I have the coordinates where I need to insert the value, and I need to be insert the value corresponding to the coordinates in the right cell.
I already tried many times using functions like MATCH, VLOOKUP and INDEX (also ROW and COLUMN) but without success, because it inserts the correct values but also other combinations of coordinates that I don't want.
My idea was to start from cell A2 and, with the formula, check if there's a match with the coordinates of row and column in the data, and finally print the value.
PS: I would prefer to avoid VBA.
Try this array formula: (Of course, change your cell ranges as necessary)
= IFERROR(INDEX($G$2:$G$4,MATCH(TRUE,ADDRESS(ROW(),COLUMN(),4)=($F$2:$F$4&$E$2:$E$4),0)),0)
Note this is an array formula, so you must press Ctrl+Shift+Enter rather than just Enter after typing the formula.
See working example below.

Excel, How to write a formula that fits these criteria

A B C D E F G
1 Date: 9/15/2016 9/16/2016 9/17/2016 9/18/2016 9/19/2016 9/20/2016
2 Points: 0.5 1 - - 0.5 1
The above data is on tab 1 of an excel spread sheet
And below are fields on tab 2 of the same excel spread sheet:
A B
1 DATE: Points
2
3
4
5
I am trying to write a formula that will go through the dates and points rows on tab 1 and when it finds a date with a corresponding point it will populate that date in tab 2 under the Date column. Simple enough right? Well here's where I'm running into problems, I need a formula to include the following criteria:
1) If the date does not have a corresponding point in the second row on tab 1 it will skip it and move on to the next date to validate it and so on
*note- I also need the Points column on tab 2 to populate with the corresponding date, but I believe a simple HLOOKUP formula will work just fine
2) I would like to have the formula to where it can be duplicated on tab 2 cells A3,A4,A5 and so on, but as an example: if A2 has date of 9/15/2016, when the formula in A3 is checking for dates with corresponding points in tab 1, it will skip the date in tab 2 located in A2 since it's already been used
Below is a picture of the above data in case it didn't come out right, and thanks for the help!!
Use this array formula:
=IFERROR(INDEX('Tab1'!$B$1:$G$1,MATCH(1,('Tab1'!$B$2:$G$2<>"")*(COUNTIF($A$1:A1,'Tab1'!$B$1:$G$1)=0),0)),"")
Being an array formula it needs to be confirmed with Ctrl-Shift-Enter when exiting edit mode instead of Enter. If done correctly then Excel will put {} around the formula.
This will create a list as it is dragged/copied done. The list will be in the same order as the list on tab1.

Excel: Obtain a column by sorting anotr one values

I need to automatically obtain a sorted column of values from another given column values, like in the sample:
I have I need A unchanged, and also B obtained from A
A A B
-----------------
1 1 0
0 0 0
3 3 1
8 8 3
0 0 8
I mean if the values from A changes, the B should change accordignly...
Is that possible in MS Excel?
Here a sandbox and sample:
http://1drv.ms/1SkqMhS
If you put The formula =SMALL(A:A,ROW()) in B1 and copy down then the cells in B will be linked to the cells in A in such a way that the numbers in B will be the numbers in A in sorted order. This won't be efficient for larger ranges but will work fine for small to medium size ranges.
If you want the numbers to start in a lower row, say B2 because you have a header in B1, adjust ROW() to something like ROW()-1.
A word of warning: Use of ROW() can make a spreadsheet somewhat fragile in that formulas that involve it can change their meaning if rows are inserted or deleted or the block containing the formula is moved to somewhere else. Rather than using ROW(), there is something to be said for adding a helper column which numbers the data in A (which would then be in e.g. B) and referring to these numbers rather than small. For example, in:
If I put the formula
=SMALL($B$2:$B$5,A2)
In C1 and copy down, it works as intended. In response to a question you raised in the comments, I added still another column which gives an index where the corresponding value occurs. To do this I wrote in D2 (then copied) the formula
=MATCH(C2,$B$2:$B$5,0)
Of course. Highlight your range and in the Data tab, click "Sort", then you can choose how you want to sort your data:
If column B has information that is to be used with Column A (like next to A1 is "Car"), and you want to sort the whole table, based on Column A, then just select Columns A and B, then sort by column A.
Found the answer, thanks to John Coleman !
Just some minor details like cell value fixing (with $, like A$2)and the -1+ROW adjustment for the 1 header row!

How to auto format a table in Excel?

I have a table in Excel. In each row, I want to highlight the columns that correspond to the maximum value in that row.
For example, if I have this table:
0 1 2 3
4 5 3 5
8 9 3 4
I want to highlight 3 in row 1, 5 in row 2 and 9 in row 3.
How can I do that automatically?
THANKS!
In Excel 2008, you can use Conditional Formatting in the Styles section of the Home Tab. Choose "Highlight Cells Rule", then "More Rules...". That opens the "New Formating Rule" dialog. Choose "Format only top or bottom ranked values". Then choose Format values that rank in the "Top" 1 and leave the % of selected range box UNchecked. Then click the Format button to pick the format that you want.
If you want to be able to do this fully automatically, what you can do is record a macro that does the actions described above and use that to repeat for all rows of your table.
I think you could do this with conditional formatting, and you wouldn't require code. Just create a formula that looks to see if the cell value is equal to MAX(range_name) and highlight the cell in whatever way you choose.
This is somewhat roundabout, but works for me. Add an extra column (E) somewhere, so you end up with this for data:
A B C D E
1 0 1 2 3 =MAXA(A1:D1)
2 4 5 3 5 =MAXA(A2:D2)
3 8 9 3 4 =MAXA(A3:D3)
Then in a cell, add a conditional format:
For A1: =IF(A1 = $E$1, 1, 0)
Use the format painter to copy this to the other cells in the row. Then copy to the column, modify each column so the $E$1 reference is corrected, and copy to those rose as well
Ugly, but gets the job done. Probably a quicker way to do it with VBA.

Resources