Excel 2007 several columns with different values, find where which number is - excel-2007

I Have 6 columns where I have up to 320 values. I say up to because the number of values differ in each column and the values also differ in the columns.
Like this:
Column A has the following values, one in each cell: 1,2,3,4,6,8,9
Column B has the following values, one in each cell: 1,3,4,6,7,8,10
etc.
I would like to know what numbers that differ between the columns, so I would like to know that 2 is missing in the B column and that 9 is missing from the A column.
Optimal would be if it were possible to have one line for each number and when there is missing I just get a blank cell on that line in that specific column.
Keep in mind that there are 6 columns.
Is this possible? Is there a workaround?
I would prefer to do this in Excel but I can use other solutions as well as long as it solves my problem.

If I understand your question correctly the following might help. (I'm assuming no header row here)
In column G put the numbers 1 to 320, e.g. 1,2,3,4,5,6,...320 - so this takes up 320 rows.
In cell H1 put the following:
=VLOOKUP($G1,A:A,1,0)
Drag the above formulae across 6 columns - so H1 to M1 and then select the 6 cells (H1:M1) and drag them down to row 320.
In the missing numbers cells you will get a "#N/A" display so you could replace the above vlookup and use an if condition if you want. Something like:
=IF(ISERROR(VLOOKUP($G1,A:A,1,0)),"",VLOOKUP($G1,A:A,1,0))
Hope this helps.

Related

Creating new rows by combining existing rows excel

I am fairly new here, so if this go against the rules please tell me.
I have an issue that seems pretty simple but I wanted to check to make sure. I have been trying to see if I could create a new row by combining every variable from one column with another, like so:
Column 1 Column 2 Combined
A 1 A1
B 2 A2
3 A3
B1
B2
B3
But instead of typing the combinations manually, I wanted the combined column make this combination without user input and to update automatically whenever column 1 or 2 has a row added or removed. I have been trying to figure out if there is some way to use the concatenate function in excel or the & sign but neither methods seems to work. I was thinking trying to code this in visual basics.
The main question: is this possible to do in excel? If so which function(s) could I use?
This assumes your data has one header row (row 1), Column 1 is column 'A' and Column 2 is Column 'B'. Place the formula below in an empty cell and copy down as far as your data permits.
=INDEX(A:A,INT((ROW(A2)+1)/(COUNTA(B:B)-1))+1)&INDEX(B:B,MOD(ROW(A2)-2,3)+1+1)
now if you want to add a little flag to let you know you have more row than you need for your data you could add the following:
=IF(ROW(A2)-1>(COUNTA(A:A)-1)*(COUNTA(B:B)-1),"Data Exceeded",INDEX(A:A,INT((ROW(A2)+1)/(COUNTA(B:B)-1))+1)&INDEX(B:B,MOD(ROW(A2)-2,3)+1+1))
According to: https://www.extendoffice.com/documents/excel/3097-excel-list-all-possible-combinations.html
You can use this formula:
=IF(ROW()-ROW(**$D$1**)+1>COUNTA(**$A$1:$A$4**)*COUNTA(**$B$1:$B$3**),"",INDEX(**$A$1:$A$4**,INT((ROW()-ROW(**$D$1**))/COUNTA(**$B$1:$B$3**)+1))&INDEX(**$B$1:$B$3**,MOD(ROW()-ROW($D$1),COUNTA(**$B$1:$B$3**))+1))
In the above formula, $A$1:$A$4, are the first column values, and
$B$1:$B$3 are the second list values which you want to list all their
possible combinations, the $D$1 is the cell that you put the formula,
you can change the cell references to your need.
In your case, you should use:
=IF(ROW()-ROW($C$2)+1>COUNTA($A$2:$A$3)*COUNTA($B$2:$B$4),"",INDEX($A$2:$A$3,INT((ROW()-ROW($C$2))/COUNTA($B$2:$B$4)+1))&INDEX($B$2:$B$4,MOD(ROW()-ROW($C$2),COUNTA($B$2:$B$4))+1))

Check the length of data in a cell and add a zero

I have a spreadsheet containing data in the following format:
Col1 Col2
ROW1: 21211 Customer 3873721
ROW2: 101111 Customer 2321422
ROW3: 91214 Customer 2834712
ROW4: 231014 Customer 3729123
I need to be able to create a macro that goes through each row and determines the number of characters that make up the row1 data.
For example:
If data contained in the first cell or ROW1 consisted of a total of 6
characters then this will remain the same. If it consisted of 5
characters then a zero needs to be added to the front of it.
I'm using Excel 2003.
VBA is not needed in this case. A simple IF Statement should do the trick. Assuming the column you want to evalutate is column A place this in column B and duplicate down the column:
=+IF(LEN(A1)=5,"0" & A1,A1)
This will work provided all values are 5 or 6 characters long as it appears in your sample data.
It seems OP may be happy with a Custom Format of:
#000000
This is easy to apply but mainly may be a good idea because most other ways of prepending a 0 are only possible by conversion of numeric values to strings (as otherwise Excel will automatically strip leading zeros). If that is done selectively (for length 5 but not length 6) a column of what appears to be numbers might end up with mixed types (of different behaviour) and so confuse or inconvenience.

VBA to check for blank cells in columns based on value in another column

Given
O 1 2 3 A
A 4 5 6 B
B 7 8 9 D
O 3
C 15
T 18
I'm looking for VBA code to validate that when column A contains a value that the remaining columns also contain values and when it doesn't contain a value, that columns 2 & 5 also contain values but 3 & 4 don't.
I've simplified the example, in a real sheet there will be many more columns and rows to check.
I've considered COUNTIF and INDEX/MATCH and array forumlas but from my understanding these all work on single columns at a time.
I want to do something like WHEN A1:An<>"" THEN COUNTBLANK(B:E) ELSE COUNTA (C:D)
Is the best way to use autofilter using blanks in A and then countblank and then a second autofilter for values in A.
Thanks
You can do it with a couple of nested IF formulae as follows:
=IF(A1<>"",
"A not empty, "&IF(COUNTBLANK(B1:E1)=0,
"B:E not blank",
"B:E have blanks"),
"A blank, "&IF(AND(COUNTBLANK(B1)+COUNTBLANK(E1)=0,
COUNTBLANK(C1)+COUNTBLANK(D1)=2),
"Columns 2&5 have values and Columns 3&4 don't",
"but condition not met"))
The reason for going down the VBA route is that I want a generic reusable function as opposed to a formula I copy between cells and sheets changing the columns etc along the way ending up with a lot of duplicate code.
So something that takes a column to test and a value to test it with. Third parameter would be a range of columns to validate, and the fourth parameter the validation.
I don't want any solution to have the columns hard coded and I don't want intermediate totals at the end of rows. This is fairly easily achieved in Excel itself...
The reason for trying to use countblank is that I can apply it to a range.
After a lot of searching I discovered this (the columns don't match the original example)
=SUMPRODUCT((A2:A19<>"")*(B2:D19=""))
=SUMPRODUCT((A2:A19="")*(D2:D19=""))
=SUMPRODUCT((A2:A19="")*(B2:C19<>""))
Nice huh? I just need to convert it into VBA now.
Thanks

Excel 2007 - Compare 2 columns, find matching values

I have two colums. Column A and Column B which have email addresses. Column A has about 3000 rows, Column B has about 1800. Is there anyway to compare the two columns, and find any fields that match...
And if so, how to either highlight or flag them as a match... or shit, for even simplicitys sake, just give me a count of how many matches were found...
Should i try a macro? Or is there a forumula that will help with this?
You could fill the C Column with variations on the following formula:
=IF(ISERROR(MATCH(A1,$B:$B,0)),"",A1)
Then C would only contain values that were in A and C.
=VLOOKUP(lookup_value,table_array,col_index_num,range_lookup) will solve this issue.
This will search for a value in the first column to the left and return the value in the same row from a specific column.
VLOOKUP deosnt work for String literals

Excel countif Pulling apart a cell to do different things

Excel 2007
I have a row of cells with variation of numbers and letters (which all mean something.. not random.)
It's basically a timesheet. If they take a sick day they put in S, if they take a partial sick day they put in PS. The problem is they also put in the hours they did work too. They put it in this format: (number)/PS.
Now if it were just letters I could just do =countif(range,"S") to keep track of how many s / ps cells there are. How would I keep track if they are PS where it also has a number separated by a slash then PS.... I also still need to be able to use that number to add to a total. Is it even possible or will I have to format things different to be able to keep track of all this stuff.
Assuming this is something like what your data looks like:
A B C D E
1 1 2 S 4/PS 8
...then you could do this:
1- add a column that just totals the "S" entries with a COUNTIF function.
2- add a hidden row beneath each real data row that will copy the numerical part of the PS entries only with this function in each column:
=IF(RIGHT(B1,2)="PS",IF(ISERROR(LEFT(B1,LEN(B1)-SEARCH("/",B1)-1)),"",INT(LEFT(B1,LEN(B1)-SEARCH("/",B1)-1))),"")
3- add another column to the right that just totals the "PS" entries by summing the hidden row from step 2.
3- add another column that totals everything by just summing the data row. that will ignore the text entries automagically.
4- have a grand total column that adds those three columns up
If you don't want to see the "S" and "PS" total columns, you can of course just hide them.
So in the end, the sheet would look like this:
A B C D E F G H I J
1 1 2 S 4/PS 8 1 4 11 16
2 4 <--- hidden row
HTH...
My quick take on this is:
pass the cell value into a CSTR function, so no matter what is entered you will be working with a string.
parse the information. Look for S, PS, or any other code you deem to be valid. Use Left or Right functions if you need to look at partial string.
check for number by testing the ascii value, or trying a CINT function, which will only work if the string can be converted to integer.
If you can show a sample of your cells with variation of numbers and letters I can give you more help. Hope this works out.
-- Mike