Displaying column headers based on value their columns hold - excel

Using Excel 2013. I require a formula to check if a range of cells in columns are 0, then the header should be displayed in a single cell. For example, for Product 1 only B, C, D should be displayed, for Product 2 E, F, H should be displayed, and in only a single cell:
Product A B C D E F G H
Product1 0 0 0
Product2 0 0 0
Product3 0 0 0 0
Is it possible?

If Product is in A1, please try in J2 and copied down to suit:
=IF(NOT(ISBLANK(B2)),B$1,"")&IF(NOT(ISBLANK(C2)),C$1,"")&IF(NOT(ISBLANK(D2)),D$1,"")&IF(NOT(ISBLANK(E2)),E$1,"")&IF(NOT(ISBLANK(F2)),F$1,"")&IF(NOT(ISBLANK(G2)),G$1,"")&IF(NOT(ISBLANK(H2)),H$1,"")&IF(NOT(ISBLANK(I2)),I$1,"")
A similar approach could be much shorter had the indictors been almost anything other than 0.

Related

Find row number of first occurrence of blank cell if conditions met

I need to search for the row number for the first occurrence of a blank cell if conditions are met. In the first column, it will need to find a 'T' and then in the 'Answer' column, a blank cell.
=MIN(IF(ExamTbl[UnLockedField]="T",IF(ExamTbl[Answer]="",ROW(ExamTbl[Answer])-ROW(ExamTbl[#Headers]),0)))
The formula I used just returns a 0 but in the picture, I am expecting 15 as that is the first blank cell that matches against a 'T'.
I have created following Excel sheet:
A B C D
1 H a
2 H <BLANK>
3 H <BLANK>
4 T b
5 T <BLANK>
6 T <BLANK>
7 H c
8 H d
In C1:C8, I've put following formula:
=IF(AND(A1="T",ISBLANK(B1)),1,0)
In D1, I've put the formula:
=MATCH(MAX(C1:C8),C1:C8,0)
In other words:
In column "C" I put a 1 if both "A" column value is "T" and "B" column value is blank.
In column "D" I look for the maximum value in "C" column (being 1) and ask for the first match, using exact match (hence the zero at the end).
So my sheet becomes (values):
A B C D
1 H a 0 5
2 H <BLANK> 0
3 H <BLANK> 0
4 T b 0
5 T <BLANK> 1
6 T <BLANK> 1
7 H c 0
8 H d 0
The 5 in "D1" is what you are looking for.

How to ensure list of numbers in excel column continues from the last non zero number

Imagine 3 columns, Column A and Column B and Column C.
Column A is a date column.
Column C is lookup column that looks up a value from 1 - 100 from a different table based on the date.
Column B is continuation of values from 0 from the first date value and continues with the value until the value in column c changes.
How do you formulate column B so it automatically keeps the last non zero value until another value in column C appears?
Column A
Column B
Column C
01/01/2021
0
0
02/01/2021
0
0
03/01/2021
0
0
04/01/2021
20
20
05/01/2021
20
0
06/01/2021
20
0
07/01/2021
50
50
08/01/2021
50
0
09/01/2021
50
0
Either
=IFERROR(LOOKUP(2,1/(C$1:C1<>0),C$1:C1),0)
Or;
=XLOOKUP(TRUE,C$1:C1<>0,C$1:C1,0,0,-1)
Or, if these values are always bigger then the last one:
=MAX(C$1:C1)
You can do it as a spill formula in Excel 365 too:
=LET(range,C1:C9,
seq,SEQUENCE(ROWS(range)),
XLOOKUP(seq,IF(range>0,seq),range,0,-1)
)

IF multiple criteria with VLOOKUP

I cant fix my formula. Or better i dont even know if im on right way.
My geal is: row B is empty, there will be formula.
A B C D
1 ID TYPE ID_Criteria
2 1 FIRM 4
3 0 HUMAN
4 3 FIRM
5 4 CORPORATE
IF A2 > 0 then VLOOKUP in row D, if false B2 is FIRM. Otherwise IF A2 > 0 then VLOOKUP in row D and TRUE B2 is CORPORATE. And last condition when A2 < 0, row return Human.
My formula:
=IF(A2>0,IF((VLOOKUP(A2,D1:D4,1,0),"CORPORAT","FIRM"),"HUMAN"))
Any ideas ?
Use
=IF(A2>0,IF(ISNUMBER(MATCH(A2,$D$1:$D$4,0)),"CORPORATE","FIRM"),"HUMAN")

Use value in cell as index for row in Excel SUM function

Given the two worksheets below, I want to put a SUM in Column F for each row but instead of SUMMING the values in Sheet1, I need to use the cell value in Sheet1 as the row number in Sheet2 and use those cell values in the SUM. For example, the SUM for Bill should be SUM(Sheet2! B1,C6,D4,E3) = 200.
Sheet1
A B C D E F
Bill 1 6 4 3 200
Sue 2 1 3 2 450
Mary 3 2 2 1 550
Joe 4 3 1 4 150
Alice 5 4 25
Bob 6 5 0
Sheet2
A B C D E
1 100 200 50 400
2 50 100 25 200
3 25 50 0 100
4 0 25 0 50
5 0 0 0 0
6 0 0 0 0
This is just a sample spreadsheet; in the real one there are already 40 columns with more being added as necessary.
In Sheet1!F1:
=SUMPRODUCT(N(OFFSET(Sheet2!$A$1,B1:E1-1+(B1:E1-1<0)*(2^20-1),COLUMN(B1:E1)-1)))
Copy downwards as necessary.
The cells Sheet2!1048576:1048576 should not have content. Because those cells will be referenced if the row number given in Sheet1 is 0 or empty.
With the data to be summed in Sheet2!A1:E6, use this formula in Sheet1's first row's column F.
=SUM(INDEX(Sheet2!B:B, B2)*SIGN(B2), INDEX(Sheet2!C:C, C2)*SIGN(C2), INDEX(Sheet2!D:D, D2)*SIGN(D2), INDEX(Sheet2!E:E, E2)*SIGN(E2))
A zero or blank in Sheet1 would mean the entire column but that is multiplied by the SIGN function of that cell's value. Anything multiplied by zero equals zero and that will not impact the overall sum.
      
Using the INDEX function with the cell's value supplying the row_num parameter allows you to avoid volatile¹ functions that would negatively impact the calculation lag of the workbook.
¹ Volatile functions recalculate whenever anything in the entire workbook changes, not just when something that affects their outcome changes.

Find value in 2D array and return value in adjacent cell

**Sheet 1**
ColumnA B C D E F G H
------------------------------------------------------------
EURUSD 1.2765 1 ACCOUNT624 2 account125 1 account834
EURCAD 1.01 2 Account49 3 account45 2 account67
EURGBP 0.78 2 Account777 1 account45 2 account678
**Sheet 2**
ColumnA B C D
---------------------------------------
EURUSD 1.2765 Account 624 ?
EURUSD 1.2765 Account 125
EURUSD 1.2765 Account 834
EURCAD 1.01 Account49
EURCAD 1.01 Account45
In Sheet 1 above each row shows a currency trade and what quantity goes to each account.In Sheet 2 each row shows 1 account only. I would like to populate columnd D in sheet 2 with the quantites from sheet 1.
Breaking it up into steps, i would like to:
Find the price in Sheet2!B1 in sheet1
On the same row in sheet1, find the cell containing the same account as Sheet2!C1
Return value in cell to the left of cell with matching account
I have used index/match before but I can't get it to work for 2 dimensional arrays. Can anyone help with a formula? Thanks in advance!
It's not pretty, but using what you requested - to find the match based upon price in column B (I would say your safer bet would be to use the Currency conversion "EURUSD", for example, since what if 2 currencies have the same ocnversion rate??), paste this formula in cell D1 on your second sheet:
=OFFSET(Sheet1!$B$1,MATCH(B1,Sheet1!$B$1:$B$3,0)-1,MATCH(C1,OFFSET(Sheet1!$B$1,MATCH(B1,Sheet1!$B$1:$B$3,0)-1,0,1,10),0))
You can then drag it down / change ranges as needed.
(PS - I'm also assuming you made a mistake on sheet2 and that the account numbers will be typed the exact same in both sheets)

Resources