Formula to dynamically create column of values, excluding some by criteria - excel

Say I have a column with these values on Sheet1:
IDs
1
2
3
4
5
6
Then a column with these values on Sheet2:
Used IDs
2
3
6
Is there a clever way I can write a formula on Sheet3 that shows only the IDs that are visible on Sheet1 but NOT on sheet2? Like this:
Unused IDs
1
4
5
I need something that would update dynamically as move values are added to the
Used IDs' column on Sheet2. I can make something work that simply omits the used IDs (retaining their rows as NULL), like this:
Unused IDs
1
4
5
However, I need something without the blank rows.

put this in A1 in Sheet3 and copy down till blanks:
=IFERROR(INDEX(Sheet1!A:A,AGGREGATE(15,6,ROW(Sheet1!$A$1:$A$6)/(NOT(ISNUMBER(MATCH(Sheet1!$A$1:$A$6,Sheet2!A:A,0)))),ROW(1:1))),"")

Related

Subtotals in a column based on ranges in another column

Consider a table like the following:
WEEKNUM HOURS WEEKTOTAL
==============================
1 2
1 4 6
2 3
2 5
2 1 9
3 6 6
... ... ...
I am searching for a formula to use in the WEEKTOTAL column that sums those entries in the HOURS column that share the same weeknumber. I would like the actual subtotal entry to be added in the row that contains the last occurrence of each weeknumber (the entries are likely sorted by weeknumber). The other cells in this column can be empty.
I'm hoping this is possible using an ARRAYFORMULA, but I am not sure how to.
Thank you in advance!
Assuming "WEEKTOTAL" cell is C1.
in C2 :
=IF(A2<>A3,SUM(OFFSET(B2,0,0,-1*COUNTIF(A:A,A2))),"")
and drag downwards.
Idea : use countif() to 'drive' offset() range. Which in turn will be the range for sum(). All only happens if the next column a value is different (IF(A2<>A3, .. ) ).
Pls share if it works/not/understandable.

Excel > Exclude a named range from COUNTIFS

I've got a spreadsheet with hundred of rows, each with a unique ID and each designated to a person.
On a different tab is a summary sheet where my formula goes (count of IDs for each person). On a third sheet, I have a named range 'excludes' which has certain IDs included in a single column.
i.e my sheet1 has:
ID Name
1 Bob
2 Bob
3 Bob
4 Shirley
5 Ted
6 Michael
The named range has say IDs, 2 and 3 in it, so I want my COUNTIFS to return the value 1 for Bob.
ID
2
3
Here's my formula but I think I'm missing something:
=COUNTIFS('Sheet1'!A:A,'summary'!$A1,'Sheet1!A:A,"<>excludes")
I want to exclude every ID in the excludes named range from my COUNTIFS result.
Do I need to use sumproduct or something?
Thanks for your help!
Use SUMPRODUCT:
=SUMPRODUCT((B2:B7=D2)*(ISERROR(MATCH(A2:A7,excludes,0))))
If you want countifs then you will need to count the whole and subtract where it exists in the named range:
=COUNTIFS(B:B,D2)-SUMPRODUCT(COUNTIFS(B:B,D2,A:A,excludes))

how to expand list into pattern in Excel?

I have a list like this:
1
2
3
4
5
I am pulling those numbers into another spreadsheet, using vlookup.
I want to create a new list or pattern, that looks like this:
1
1
1
1
1
2
2
2
2
2
3
3
3
3
3
.. etc
How can I do that easily (my first list has 300 items, so dont want to do by hand)
Thanks!
Following the Scheme:
use the formulas:
C2 -> =A2
C3 -> =INDEX(A:A;ROUNDDOWN((ROW(G1)/$B$2)+2;0)) ' And Autocomplete
D2 -> =IF((ROUNDUP(ROW(G1)/($B$2+$B$4);0))-(ROUNDDOWN((ROW(G1)/($B$2+$B$4))+($B$4)/$B$2-$B$4/10;0))=1;INDEX(A:A;ROUNDDOWN((ROW(G1)/($B$2+$B$4))+2;0));"") ' And Autocomplete
The C column it's relevant to repeat without blanks, the column D it's relevant to the repeat with blanks.
In the cells B2 put the number of repetition and in the cell B4 put the blanks cells.
If you have more that one column to copy use the same code for every column...
If you need to have only values, at the end copy and paste with value ...
Warning: The formula in column D work with low number of blanks and Repeat... Eventually you need to recalibrate.

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!

EXCEL match 2 columns against each other

I have two columns of data, they look something like this:
A B C D
1 2 SOME RECORD
2 6 SOME RECORD
3 10 SOME RECORD
4
5
6
7
8
9
10
So basically column A is a list of indices, where some of them appear in column C with corresponding records saved in column D. Column B is currently empty, and what I want to do is if say index 2 appears in both column A and column C (they matches), then put the record beside C2 in the cell B2. So essentially I want it to look like this:
A B C D
1 2 SOME RECORD
2 SOME RECORD 6 SOME RECORD
3 10 SOME RECORD
4
5
6 SOME RECORD
7
8
9
10 SOME RECORD
Can someone help please?!! Thanks!!!
UPDATE: I tried this and it doesn't work. The data in column D is calculated using a UDF and is refreshing every 1 second. The VLOOKUP function fails even though I can see the 2 indices are the same!! Is it because of the format of the cell or column? I.e. does vlookup compare data type as well?
Assuming your data in A starts from A1 - put in B1 the following and autofill:
=IFERROR(VLOOKUP($A1,$C:$D,2,0),"")
This includes handling of missing values.
You'll want this:
B1=VLOOKUP(A1, C:D, 2, FALSE)
This will look up the value in column A within the array spanning columns C and D. It will give you the value found in the second column (D). FALSE makes it an exact match, otherwise you might get 2 and 20 matching because hey, they're kind of similar...

Resources