Display headers in Excel only when the range has values - excel

I am trying to Display in Column A (A23:A29) the header of a table only when it has values on either column B (Current Pay) or C (Year to Date).
I am able to display it when both have values, or when B has a value (positive or negative). But I am not able to display the header when only C has a value (but not B). (Also could I remove #N/A when there is no values or both are zero?)
I have attached a picture to show the layout and added some dummy values to show when it works and when it doesn't.
I am using the following formula in column A:
=IF(COUNTA($B23:$C23)=0,"",INDEX(PP[[#Headers],[Column1]],MATCH(TRUE,INDEX($B23:$C23<>0,0),0)))

MATCH(TRUE,INDEX($B23:$C23<>0,0),0)
gives value 2 and then it searches for header in row 2. Thats why Reference Error
If you want only headers from row number 1 then try replace above with 1 as below. Then it will take header in case both the columns are filled or any one column is filled
try this
=IF(COUNTA($B23:$C23)=0,"",INDEX(Table2[[#Headers],[Column1]],1))

Related

How to lookup a value from another column and display Row number?

I'm setting up an excel file for the operators. They will scan the Barcode from the product and it will populate in one of the column of the excel sheet.
I have tried using LOOKUP formula in excel but it doesn't seem to be working right.
COL A : Data from Database
COL B : Data from Scanner
COL C: Row number
Find the value of Column B in Col A and populate the Row no. in Column C.
=LOOKUP(B5,A:A,ROW(A:A))
I have used this formula in every cell of the column C.
The row number don't populate accurately.
=MATCH(B5,A:A,0) should give you the rownumber. And if you wish to obtain the cell's address: =ADDRESS(MATCH(B5,A:A,0),1,4,1)
If you are using combined cells then you definiately want to use absolute ranges like =MATCH(B5,$A$5:$A$10,0)
Search B column in A column and get row back. You could use:
Note:
Do not forget to use IFNA in case of B does not included in A.
In my opinion there is no need to target whole range.
=IFNA(MATCH(B1,$A$1:$A$6,0)+ROW($A$1:$A$6)-1,"")
Results:

Advanced Lookup Formula

I am in need of an advanced lookup formula that will search through data from one table and produce a value based on conditions from another table.
What I am trying to achieve is this:
If Column J in Table 1 is equal to column A in Table 2 and
Column L in Table 1 is equal to Column D in Table 2
But Column D in Table 2 is blank but there are values in Column L of Table 2 except the value specified in Table 2 previously
And Column G in Table 1 is equal to Column B in Table 2
But Column B in table 2 is blank but Column G in Table 1 has values except the one specified previously in Table 2
And if Column O in Table 1 is equal to Column C in Table 2
But Column C in Table 2 is Blank and Column O in Table 2 contains values other than previously specified in Table 2
The end result should be column E in Table 2.
I used this formula but it is showing a value error
=IF(AND(Trans!J:J=Mapping!A:A),Mapping!E:E),IF(AND(Trans!L:L=Mapping!D:D),Mapping!E:E),IF(AND(Mapping!D:D="",Trans!L:L<>""),Mapping!E:E), IF(AND(Trans!G:G=Mapping!B:B),Mapping!E:E),IF(AND(Mapping!B:B="",Trans!G:G<>""),Mapping!E:E),IF(AND(Trans!O:O=Mapping!C:C),Mapping!E:E),IF(AND(Mapping!C:C="",Trans!O:O<>""),Mapping!E:E)
The formula can also be searching by row. I would just like something that works!
Please help.
Your formula is doing nothing, it seems you are combining all the logics you thought in one place, but it is not in a form that excel can understand.
As per my understanding you have to remove the blank checks, as per your data they may return unexpected results, if their is one blank or if there are more in both cases result would be different, you would not know the reason of a returned value. (it is not logical to make a check like that)
A logic like this may return more than one value, you have to put some formula in case there are more values returned.
AS for the formula, you are comparing a full column with a full column. It is not recommended to do that, the recommended way is to compare one value to a range of values and the function AND() is not required in the way you are using it
a comparison in the formula would be something like
=IF(Trans!J3=Mapping!A3:A20,Mapping!E3:E20,"")
and it is an array formula that can return multiple values
At the end summary is that first you have to define the logic you are making, it is not clear and not accounting for all possibilities after that learn how to apply such formulas and then apply it on your data.

VLOOKUP not returning correct values

Maybe I'm using ´VLOOKUP´ wrong, but I've tried even using a table array. It continuously returns a ´N/A´ or ´#REF´ error back to me.
The spreadsheet is setup with a sheet titled 'Character', ´C6´ is a drop down menu, and ´D6´ is where the ´VLOOKUP´ formula is being written. I have a 2nd sheet listed named, 'Weapon', which is a 13 row sheet with various different text and numerical data information. I'm only trying to pull the numerical data from the 6th row, or column F.
So, this is the function I'm writing:
´=VLOOKUP($C$6,Weapon!$A$2:$M$78,6,0)´
What's odd about this is if I check
´=VLOOKUP($C$6,Weapon!$A$2:$M$78,1,0)´
It will return the text data of the first result in the A column on the 'Weapon' sheet, but it won't return anything else in B,C,D,E,etc. columns if I change that 1 to a 2,3,4,5, etc.
Any insight would be great.
For VLOOKUPs to work, it's the lookup value that is the critical part. And that critical part has to be unique and it has to be in the first column. Your table of data on the Weapon sheet has "Staff" in Column A.
A quick fix for you is to change your formula to
=VLOOKUP($C$6,Weapon!$B$2:$M$78,5,0)
Notice the left-most column of the range is now column B and we're getting data from the 5th column.
This assumes that your values in column B are unique and will match up with the values in your drop-down menu in C6 on the Character sheet.

Excel/VBA - Chart range based on nonempties of column

Consider a list of dates showing in column A, with associated values in column B. Some of the values in column B are shown, some are not (i.e. "" resulting from an IF statement).
What are my possibilities to create a chart which automatically adjusts it range to only contain the dates in A and values in B, based on the non-hidden values in column B (ie which are NOT ""). It should be able to recognize if any changes happen to values in column B and ajust accordingly.
For instance (no headers), B1 is "", B2:B3 has values, B4 is "", the chart should only be based on row 2 and 3.
In Excel you can use a return value of NA() rather than "" to ensure a point isn't plotted. You would need to consider if also implementing something similar for the axis (so hide associated Date). Below is first google search that came back for me.
See here: hiding data points

Find the difference between data in 2 columns in Excel

I have 2 sets of data. I put it in Excel e.g. column A and column B. Now I want to know which data from B is part of column A. I run this formula =IF(COUNTIF($A$1:$A$327238,B1)>0,"Exist", "Nope")
Then I 'filter it and look only 'Exist'. Based on that I know that all data in B that has label 'Exist' is part of column A
Now I want to know opposite i.e. which data from A are part of B. For that reason I use the same formula but I replace the data in columns i.e. data from B now in A and vice versa.
Then I randomly verify results.
For case 1 it looks it works fine but for second case it looks it's not accurate.
My assumption: should it work in case 2 as well ( maybe I just was not very accurate in some way ) and I should expect it to work?
Thanks
In cell C1 (assuming your data starts from 1st row) type the following =IF(A2=B2,"equal","no"), and then populate the same formula to the last row where there is still data, so that for row N, your formula in column C is =IF(AN=BN,"equal","no"). After that you will just need to count the cells with value "no" to know the differences. Sorry if I didn't get the question correctly.
Ok, assuming that the two sets of data are in columns A and B (they might be of different sizes), and the last rows of data are L and M respectively, click on D1 and type the following: =IFNA(INDEX(B$1:B$5,MATCH(A1,B$1:B$5,0),1),"Unique"). Drag down to apply this formula on D1 - DL. That's it, you have the duplicate elements. Since the duplicate elements are the same in both columns - A and B, you don't need to repeat this for column B. Note, that for all the unique elements the corresponding rows of column D have the word "Unique", so if you want the unique elements, you can just get the elements from A with the mentioned row numbers:
Just select any column's first row cell and type the following formula: =IF(D1="Unique",INDEX(A$1:A$L,ROW(D1)),"Duplicate").

Resources