Excel - Find Column and Row from Table - excel

I'm trying to build a Sudoku calculator using only Excel (no VBA). As part of the process, I'm using the Position table (see image) as my reference for each cell. If I look at say position 12 in the table, how would I pull column 4 in one formula and row 2 in another formula?

Use AGGREGATE:
Row:
=AGGREGAT(15,7,(ROW($N$5:$V$13)-MIN(ROW($N$5:$V$13))+1)/($N$5:$V$13=12),1)
COLUMN:
=AGGREGAT(15,7,(COLUMN($N$5:$V$13)-MIN(COLUMN($N$5:$V$13))+1)/($N$5:$V$13=12),1)
replace the =12 with = and your cell reference.
But if you use base 9 with two digits, you can just parse the number:
ie:
Now the first digit + 1 is the row and the second + 1 is the column

Related

All combinations of 4 out of 7 columns with totals using excel

I have 7 columns to choose from and I need to pick 4 of those columns and generate a total for each row. I also need every combination of 4, which means I'll have 35 new columns with the totals for each of those combinations showing in each row. I need the code for this and if it can be done only using Excel. Here is an image of the columns and the grayed ones are the 7 columns I'm talking about. My knowledge of Excel is very limited. There are over 1,500 rows if that matters.
multi step approach that is going to use some helper rows. there may be a more elegant formula that will do this, and much slicker options in VBA, but this is a formula only approach.
Step 1 - Generate List of Column Combination
To generate the list 4 helper rows will need to be insert at the top of your data. either above or below you header row. These 4 rows will represent the column number you are going to pick. To keep the math simpler for me I just assumed the 1 for the first column and 7 for the last column. those numbers will get converted to later to account for column in between in your spreadsheet. For the sake of this example The first combination sum will occur in column AO and the first helper row will be row 1. The first combination will be hard coded and it will seed the pattern for the remainder of column combinations. Enter the following values in the corresponding cells:
AO1 = 1
AO2 = 2
AO3 = 3
AO4 = 4
In the adjacent column a formula will be placed and copied to the right. It will automatically augment the bottom value by 1 until it hits its maximum value at which point the value in the row above will increase by 1 and the the value of the current will be 1 more than the cell above. This will produce a pattern that covers all 35 combinations by the time column BW is reached. Place the formulas below in the appropriate cell and copy to the right:
AP1
=IF(AO2=5,AO1+1,AO1)
AP2
=IF(AO2=5,AP1+1,IF(AO3=6,AO2+1,AO2))
AP3
=IF(AO3=6,AP2+1,IF(AO4=7,AO3+1,AO3))
AP4
=IF(AO4=7,AP3+1,AO4+1)
Step2 - Sum The Appropriate Columns
I was hoping to use a some sort of array type operation to read through the column reference numbers above, but I could not get my head around it. Since it was just 4 entries to worry about I simply added each reference manually in a SUM function. Now the important thing to note is that we will be using the INDEX function over the 13 columns that cover the range of your columns so to convert the index number we figured out above, to something that will work to grab every second row, the number that was calculated will be multiplied by 2 and then 1 will be subtracted. That means 1,2,3,4 for the first column combination becomes 1,3,5,7. You can see this in the following formula. Place the following formula in the appropriate cell and copy down and to the right as needed.
AO5
=INDEX($AB5:$AN5,AO$1*2-1)+INDEX($AB5:$AN5,AO$2*2-1)+INDEX($AB5:$AN5,AO$3*2-1)+INDEX($AB5:$AN5,AO$4*2-1)
pay careful attention to the $ which will lock row or column reference and prevent them from changing as the formula is copied.
Now you may need to adjust the cell references to match your sheet.

getting strange formatting after doing excel formula

I'm trying to create a simple excel formula that has a number on A1 and for each row, it adds 1 to the total
Formula: =SUM(First Row Value + 1)
First Row Value: 5472611273010295
Expected Value: 5472611273010296
Actual Value: 5.47261E+15
How can I change the formatting to show the expected value? I tried rounding and that didn't fix it either.
Excel uses only 15 digits of number precision
You may not be able to resolve this issue short of breaking your formula into parts, or using VBA.
For example if you put the first 8 digits into Column B and the Second 8 digits into column C, you can then create a helper row to do this for you.
Column B Column C Column D Column E
54726112 73010295 =C2+1 =B2&D2
54726112 73010295 73010296 5472611273010296

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.

Formula to sum items in a column only if other column has specific value

I have an excel table with 2 columns. First column contains a string such as A,B,C and second column contains numbers. I want to obtain sum of numbers in each row if text of first column for that row is equal to given text.
For example:
A 2
C 3
B 4
A 1
C 3
formula(A) = 3
formula(B) = 4
formula(C) = 6
and so on.
One way to achieve this is via SubTotal option. Follow the example in this link Creating subtotals
Another way to do the same is using sumif function follow this link Sumif function
SUMIFS() is capable of doing this. As is SUMPRODUCT()
In european excel this would look like this. I don't know where your reference is so I am putting it in a cell named Reference.
SUMIFS($B:$B;$A:$A;"="Reference)
If you want a "running" count, then replace the arrays - from $B:$B to B$2:B2 and similar with $A:$A, and copy it down the rows.

Format Cells from 2 sheets, based on 4 column comparison

I need to find changed values in dataSet.
So I have 2 sheets with, in general, same data.
I have two columns: docID(which is unique key) and rev(which is not unique).
I need to find(highlight/display only/...) those rows, where for same docID from first sheet rev is different in the second sheet.
UPDATE 1
Sheet 1:
docID rev
1 5
2 6
3 1
Sheet 2:
docID rev
1 6
2 6
3 1
Only the first row makes an interest to me, as others did not changed.
UPDATE 2
simple if statement which should give some understanding what I need. In general this is done on similar test data set, so cells are incorrect.
=IF(NOT(AND($B6=Sheet1!$B6;$C6=Sheet1!$C6));1;0)
So values are NOT equal.
You can do this with a custom formula in Conditional Highlighting:
Select the top cell in the column docID column, then select the whole column (in the example, I assume that this is column A and you select A1 and the rev is in column B, same structure in both sheets. Adjust as to your needs)
Goto home->Conditional Formatting->New rules->Use formula to determine which cells to format and enter the following formula:
=VLOKUP(A1,Sheet1!$A:$B,2,0)<>B1
Click on format and select the format you need.
Done!

Resources