EXCEL counting empty rows - excel

A B C D E F G H
1 Y Y Y X
2 X X
3 Y Y
4 X X
5 Y Y Y X
Count the number of empty rows (from Columns A to E) and put result here. Answer should be 2 from example above.
Hi Folks,
I'm struggling to find the correct Excel formula to count the number of rows with no data from columns A through E, and putting that answer in a cell. These 'empty rows' may have data in later columns (like F, G, H), but I just want to count the rows with no data from columns A to E.
Any help would be appreciated.

Since array formulas tend to confuse people, here's a non-Array formula approach:
Place =IF(COUNTA(A1:E1)=0,1,0) into row 1 of (for example) column I and drag down to row 5. Then place a sum formula below that to get the answer, for example: =SUM(I1:I5)

Try this array formula,
=SUM(IF(ROW(1:5), IF(A1:A5&B1:B5&C1:C5&D1:D5&E1:E5="", 1)))
Remember to finalize with ctrl+shift+enter, not just enter.

You could also use a variation on the standard formula for getting row sums of a 2d array
=SUM(N(MMULT(N(A1:E5=""),TRANSPOSE(COLUMN(A1:E5)^0))=COLUMNS(A1:E5)))
or
=SUM(N(MMULT(N(A1:E5="Y"),TRANSPOSE(COLUMN(A1:E5)^0))=0))
Again they are array formulas and have to be entered with CtrlShiftEnter

Related

Return Multiple Unique Matches in Excel without Array Formula

Given an Excel table of shape
Col. A Col B Col. C Col. D Col. E
x 2 x 2 3
x 3 y 7
y 7 z -5
x 2
z -5
I want to return the first unique hit in Column B for argument "x" in Column D,
the second unique hit in Column B for argument "x" in Column E and so forth.
The formula I'm currently using in cell D1 for this is
{=IFERROR(INDEX($B$1:$B$5,MATCH(0,COUNTIF($C1:C1,$B$1:$B$5)+($A$1:$A$5<>$C1),0)),"")}
which is working.
The problem I'm having is that since this is an array formula and since I'm analyzing a decent amount of data computation time for my sheet is too high.
Is there an alternative for this functionality avoiding an array formula?
Thanks!
Haven't got time to test this properly, but if you have Excel 365 you can use a single formula per row and it may be faster:
=TRANSPOSE(UNIQUE(FILTER(B1:B10,A1:A10=C1)))
in D1.
EDIT
To pull the formula down, you need static references as OP has pointed out. Probably should check for empty cells in column C as well, so formula becomes:
=IF(C1="","",TRANSPOSE(UNIQUE(FILTER(B$1:B$10,A$1:A$10=C1))))

Find all increments of +1's starting from a given number in a column in excel

I have 2 columns x and y
x Y
0 1
1.645 7.897
3.444 6.4387
2.345 5.9090
3.890 5.4322
4.789 3.4321
5.666 4.1111
keeping x at a constant value ( say i pick 3.890) i want to find all increments of +1's of the corresponding Y column . In the above example I want (5.4322 + 1 + 1 + 1 ) upto a certain range.In the above example i want the values (6.4387, 7.987) .If an exact +1 value does not exist i want the closest value to it .Is there a formula i can use to achieve this in excel ? . Any help is much appreciated.
expected output :
New column
5.4322
6.4387
7.897
Suppose you have the following named ranges:
x being values under x column;
y being values under y column;
Pick_x being the selected value from x column.
Enter the following formula in Cell G2 and drag it down to G8:
=IF(INDEX(y,MATCH(Pick_x,x,0))+1*(ROW(A1)-1)>MAX(y),"",INDEX(y,MATCH(Pick_x,x,0))+1*(ROW(A1)-1))
It will return the corresponding y value +1s based on the selected x value, but will show blank if the +1 value is outside the range set by y column.
Then enter the following array formula (confirm by pressing Ctrl+Shift+Enter in the formula bar) in Cell H2 and drag it down to H8:
{=IFERROR(INDEX(y,MATCH(MIN(ABS(y-G2)),ABS(y-G2),0)),"")}
It will return the corresponding closes match from y column based on the value in Column G, and return blank if there is no value in Column G.
I used Column G as a helper column but you can choose to replace G2 in the second formula with the first formula, but it will make the formula too long to be easily understood.
If I change the x value to 4.789, Column H will return the following:
Let me know if I've misinterpreted your question. Cheers :)

Is there a formula that inputs on nth row of column A by reading what's in column F and/or D on their congruent rows?

I'm very new to excel programming. Currently I'm working on an excel worksheet and I need a formula that inputs on nth row of column A by reading what's in column F and/or D on their congruent rows. So far I have something like:
=IF(AND(D:ROW(n)=0,F:ROW(n)="x"),A:ROW(n)="e",IF(D:ROW(n)=0,"N","X"))
e.g.
A B C D E F
1 e 0 x
2 N 0
3 X 2
Put this in A1:
=IF(D1 = 0,IF(F1="x","e","N"),"X")
And copy down.
The references are Relative, so as the formula is copy/dragged down they will change on their own.

How do I convert rows to columns, and repeat the adjacent cells?

I'm sorry if the title is confusing, but a visual should hopefully help:
Here's what my sheet looks like:
A B C D
1 x y z t
2 q w e r
3 y u i o
I need to generate a separate sheet wherein:
A B C
1 x y t
2 x z t
3 q w r
4 q e r
...
Basically, I need the middle two columns of the original sheet to be transposed and the adjacent columns to it pulled into my new sheet as well (as duplicate rows).
I have the transpose working correctly, and when I pull the adjacent columns that works too. The issue is, I can't autofill the sheet. When I try to drag & autofill, instead of autofilling using row 2 from the original sheet, the new sheet will autofill using row 3 (which is the same row # in the new sheet).
Please let me know if this isn't making sense, I'll try to explain better! I'm not very well versed in the Google Spreadsheets scripts - I've tried before but they seem rather cumbersome. But I'm happy to try that as well.
I'm not sure where a transpose operation would come into play but a little conditional maths and the INDEX function¹ should suffice.
=INDEX($A$1:$D$3,(ROW(1:1)-1)/2+1,IF(COLUMN(A:A)=3,4,IF(AND(ISEVEN(ROW(1:1)),COLUMN(A:A)=2),3,COLUMN(A:A))))
The documentation I've linked to is Excel but the syntax is identical for these purposes.
Addendum for more columns
By adjusting the condition for the offset after the third column, more columns can be readily accounted for.
=INDEX($A$1:$J$3,(ROW(1:1)-1)/2+1,IF(COLUMN(A:A)>=3,COLUMN(A:A)+1,IF(AND(ISEVEN(ROW(1:1)),COLUMN(A:A)=2),3,COLUMN(A:A))))
The above collects 10 columns from the source matrix but should be auto-adjusting for pretty much any number of columns.
¹ The INDEX function accepts parameters for both row number and column number. Although typically only one of these is used, there is no restriction against supplying both against a 2D range of cells.
Put the row_number calculation,      =(ROW(1:1)-1)/2+1 into a cell and fill down. You will receive 1, 1, 2, 2, 3, 3, etc. This supplies the repeating row number from the A1:D3 range.
Put the column_number calculation,      =IF(COLUMN(A:A)=3,4,IF(AND(ISEVEN(ROW(1:1)),COLUMN(A:A)=2),3,COLUMN(A:A))) into a cell and fill right and down. You will receive 1, 2, 4 for the first row and 1, 3, 4 for the second. This pattern repeats itself for subsequent rows and supplies the offset column numbers from the A1:D3 range.
You can do this with 3 single arrayformulas that are dynamic to work with any number of rows of data:
Here is an image to demonstrate:
The three formulas are:
CELL A1:
=TRANSPOSE(SPLIT(JOIN(";",ARRAYFORMULA(REPT(Sheet1!A1:A&";",2))),";"))
CELL B1:
=TRANSPOSE(SPLIT(JOIN(";",ARRAYFORMULA(Sheet1!B1:B&";"&Sheet1!C1:C)),";"))
CELL C1:
=TRANSPOSE(SPLIT(JOIN(";",ARRAYFORMULA(REPT(Sheet1!D1:D&";",2))),";"))

Compare values from multiple columns

I'm trying to compare values from multiple columns and then highlight the row if it matches my criteria using conditional formatting. For example: in the table below, there are four columns, and I want to compare the values within the the 3 columns: A-C. If they all match, then I want to highlight the entire row. When I use conditional formatting, I'm only able to compare two of the three. I don't know the syntax to compare more than columns.
A B C
Name Has Dog Has Cat Has Bird
A Y Y Y
B Y N Y
C Y Y N
D N N Y
E Y Y N
Please try:
=AND($B1=$C1,$B1=$D1)
for Format values where this formula is true: and Applies to all the columns you have available.

Resources