Excel formula to output name in first column based on a value in the 3rd column - excel

I have a data table with 8 columns and i want to know if anyone can help me come up with a formula to get the name in the first column if i enter a value into the columns (3,4,5,6,7,8).
I want the name from the first column to appear in another table on another sheet where only names appear where data is in the columns (3,4,5,6,7 & 8)

Try this:
=IF(OR(Sheet1!C2<>"";Sheet1!D2<>"";Sheet1!E2<>"";Sheet1!F2<>"";Sheet1!G2<>"";Sheet1!H2<>"");Sheet1!A2;"")
You can use C1 = 1 .... if you prefer.
And C1,D1,E1... have to be replaced with your columns.
Also Sheet1 have to replaced with your sheet name

I would use a Pivot tables.
First create a new column in the existing table:
If you only having positive values then it is:
=sum(C2:H2)
If you have zero and negative values as well it would be like this:
=IF(COUNTBLANK(C2:H2)=6;0;1)
Then make a pivot table with the "TO/TA name" in the Row Labels and the new column in Report filter - where you then removes the "0".

Related

How to sum over criteria in Excel?

Let's say I have a table of First/Last names and Salaries.I want to compute, for every last name, the sum of the salaries of people with that name.
I know how to do that for each name individually using SUMIF, but I was wondering if there is a quick function to produce a table of Last names and Salary sums?
Another option would be using a pivot table.
On the insert tab, select pivot table
Use your existing table as the data
In the fields select the Last Name and Salary columns
Let's support you have the salary sheet in sheet1 as below,
copy column last name value to sheet2.column A, remove duplicate, add a new column as Salary Sum in column B, input a formula as =SUMIF(Sheet1!B:B,Sheet2!A2,Sheet1!C:C) and drop down to all rows, then you can got a salary sum table as below,
of course, if the first name/last name is dynamic and unexpected, it would doesn't work. you can drop a button and bind a VBA code to handle it.
You could use this ARRAY FORMULA: CTRL + SHIFT + ENTER
=IFERROR(INDEX($A$2:$A$7,MATCH(0,COUNTIF($D$1:D1,$A$2:$A$7),0)),"")
For summing up the corresponding values just use
=SUMIFS($B$2:$B$7,$A$2:$A$7,D2)

How to reference table column header name and table row number?

I'm trying to populate a new table in a new worksheet with data from an existing table in a different worksheet. I need to reference the column header name because the positions of the columns may change.
I currently have this:
=TableName[#[ColumnHeaderName]]
This works but the problem is when I try to sort any of the columns in the new table, it doesn't sort because it is referencing the same row in the existing table. I'm guessing I need to reference the column name and row number, but when I try "=TableName[#[ColumnHeaderName]] 2:2" it displays #VALUE!.
Any help would be greatly appreciated.
It seems that you are working with excel tables (i.e. ListObjects).
The formula:
=TableName[#[ColumnHeaderName]]
refers to the
- Table: TableName
- Column: ColumnHeaderName
- Row: Row of the cell where the formula is entered from the Worksheet where the Table is located.
Therefore if the TableName header is located at row 6 of Sheet1 and the formula is entered in row 8 of Sheet2 it will return the value in column ColumnHeaderName, row 8 of Sheet1 which is the row 2 of the Table.Body (e.i. DataBodyRange)
To return the first value in column ColumnHeaderName of the TableName use this formula:
=INDEX(TableName[ColumnHeaderName],1)
TableName[#[ColumnHeaderName]] refers to the same row of the table and
TableName[ColumnHeaderName] refers to the entire column.
Also, any of the above formulas exclude the header of the Table.
To refer to the header use:
=TableName[[#Headers],[ColumnHeaderName]]
if you want to refer the entire header use:
=TableName[#Headers]
Since you are entering the formula in another excel table, lets named it Table2, in order to have the row number dynamically updated enter this formula:
=INDEX(TableName[ColumnHeaderName],ROW()-ROW(Table2[#Headers]))

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.

Delete all rows with criterias

I need VBA code that will delete all rows with column A equal to "XXX" if column B is equal to "YYY".
Example: I have a spreadsheet that looks like this: column A has multiple rows with the same value but the value in column B is different for every row. I want to delete all the records with the same value in column A if column B has a specific value.
This is something that would be very easy to create using the Macro record feature of excel and then modify the code to fit the specifics you are needing.

Convert Semicolon Separated Values to Columns - Excel

I have a spread sheet of values organized by id number with a column of semicolon separated values.
I would like the spread sheet to be organized by id number with a column for each value and if that value exists for a id number a 1 be placed in the cell and if it doesn't exist a 0 placed in the cell.
Has anyone done this before or know where I should start?
You can try this but you need to keep the original value somewhere and then use this formula:
=IF(ISERROR(SEARCH(C$1,$B2)),0,1)
Your data layout should be like below:
So Column B contains your original data and your new headers starts at Column C.
Enter the formula in C2 and copy to the rest of the cells. HTH.

Resources