Copy data if all cells match - excel-formula

I have 4 columns and I need to get the data from 1 of those columns (3) to another (4) but to get that data to that column (4). That columns (4) header must be linked to a cell in another column (2) which has the same name as the header in (4) shown below.
example
Sku (1) Attribute(2) Attributeresult(3) screensize(4)*
123 Screen Size 22" 22" (match)
124 CPU AMD (no match)
125 CPU Intel (no match)
126 Screen Size 24" 24" (match)
*
Column 4 Header Has the same name as some cells in (2) cell but no spaces or caps which col2 has.
So I want to get data from (3) to go in to (4) if the names in (2) & (4 header) match. The position of the (4) will be determined by the SKU (1). Also (4) is the 1 of 500 columns in the same way
Hope this made sense
Thanks

This formula should do:
=IF(LOWER(SUBSTITUTE($B2;" ";""))=D$1;$C2;"")
Using LOWER and SUBSTITUTE you delete any spaces from the value in B2 and also turn everything into lowercase letters. You can then compare this string to your column header in D1 and return only the values of those rows, that match your criteria.

Related

How can I assign a value to a cell by referencing a seperate table in Excel/Mac Numbers?

Table 2
Pts
# of tix sold
0
100
1
200
2
300
3
400
4
500
5
600
Example: In Table 1 Tim sold 198 tickets. He didn't make it to 200 tickets sold, so he gets 0 pts. Bill sold 220, so he gets 1 pt. The points show in the cell next to the name on Table 1, but references table 2.
I tried using xlookup and index, but I don't really know what I'm doing.
XLOOKUP provides several matching modes, and one is "exact match or next smallest" which is what you want. If the lookup value is 225, I want it to start down the list, and if it finds 225, it selects that row; if it encounters any number > 225 then it knows it's gone too far and selects the previous number. This sounds like the logic you want.
Assume:
Tim's ticket count is in B2, and you want his points in C2;
The lookup table is on a second worksheet, titled "Table2";
The lookup table headers are A1:B1, and the data is the 6 rows below that;
The lookup table should be in ascending ticket count order.
Then, in table1 cell C2 place this:
=XLOOKUP(A2, table2!$B$2:$B$7, table2!$A$2:$A$7, "", -1)
And copy it down the rows of column C.
The -1 argument tells lookup "exact match or next smallest".

How to get maximum number and name from 2 columns? (Excel)

I have this (example):
Luffy 320
Coby 350
Zoro 180
Now I want to show the max from this info, with number and text (in seperate cells) like this:
col 1 col 2 col 3
1st 350 Coby
2nd 320 Luffy
3rd 180 Zoro
The 2nd Column no problem with the MAX() formula.
For the 3rd column to get the text I've tried the MAX(...) and INDEX(...) formulas but nothings working ...
Can anyone help me?
You first need to get which value is the largest, second largest and so on.
You can use the function LARGE(range, n) for this.
So in your col 2 use this formula:
=LARGE(B:B,1)
=LARGE(B:B,2)
=LARGE(B:B,3)
Assuming B is the column with the values.
Then we need to match this value and get the name
=INDEX(A:A,MATCH("the above calculated cell",B:B,0))
With the above calculated cell I mean the LARGE function cell. And assuming column A is the column with the names.
This should give you a dynamic table that will update when values or names change.
I'm not sure how you manage to get that column 2 using MAX formula since it only outputs the largest number of the inputs and thus can't output 2nd and 3rd position.

How do I split a row of text into different columns according to number of characters using a macro in Microsoft Excel?

I want to know if I can use a macro in Excel to separate data in a single column into different colums according to number of characters. For example, what I have is this in column A
A
AB
ABC
1A
564
8
What I need is this, in colums A, B and C
A AB ABC
8 1A 564
Thanks.
Use the following formula in a new column B next to Column A:
=IFERROR(INDEX($A$1:$A$6,SMALL(IF(LEN($A$1:$A$6)=1,ROW($A$1:$A$6),99999),ROW()),1),"")
Array Formula press Ctrl+Shift+Enter at the same time
and drag it down, it will write the Values of B whose Length is 1, and when it gives empty it means no more Values with Length 1
Small will find the Cell which length is 1 (Row()=1, 1st cell which length=1, Row()=2, 2nd cell which length =1 ...)
If will return all the rows for the corresponding condition
Index will return the Cell
Iferror return empty "" if no more match
For the second column write 2 instead of 1 in LEN($A$1:$A$6)=2
=IFERROR(INDEX($A$1:$A$6,SMALL(IF(LEN($A$1:$A$6)=2,ROW($A$1:$A$6),99999),ROW()),1),"")
For the third column write 3 in LEN($A$1:$A$6)=3
=IFERROR(INDEX($A$1:$A$6,SMALL(IF(LEN($A$1:$A$6)=3,ROW($A$1:$A$6),99999),ROW()),1),"")

excel table row column lookup

I'm struggling with some Excel functions.
I have a table with row header and column header and then data. For example:
If I have a type of pizza, crossed with its Size, and the data is the price.
S M L XL
Cheese 6 6.5 8 10
Pepperoni 6.5 7.5 10 12
Supreme 8 9 12 15
If I have this table in excel, how can I do a lookup of the price if I know I want "Cheese", "M"?
The row and colmn headers will be text and not necessarily be in any type of sorted order.
thanks!!
Use Index match:
=INDEX(A:E,MATCH("Cheese",A:A,0),MATCH("M",1:1,0))
To call with data in cells so it is dynamic:
Say in F1 you have Cheese and in G1 you have M:
=INDEX(A:E,MATCH(F1,A:A,0),MATCH(G1,1:1,0))
The first part of the Index formula is the Search range. In this case full column A to E.
The second part denotes what row. The match finds the first instance of "Cheese" in column A and returns that row.
The third part denotes the column. That match finds "M" in Row 1 and returns the column number.
Now Index, using those coordinates, knows what to return.
Adjust your range references as necessary ($A$2:$E$4 contains the table data, $A$1:$E$1 is your headers - sizes in this case). You can also replace the "Cheese" and "M" with cell references.
=VLOOKUP("Cheese",$A$2:$E$4,Match("M",$A$1:$E$1,0),FALSE)

Sum the values in Excel cells depending on changing criteria

In an Excel spread sheet I have three columns of data, the first column A is a unique identifier. Column B is a number and column C is either a tick or a space:
A B C
1 d-45 150 √
2 d-46 200
3 d-45 80
4 d-46 20 √
5 d-45 70 √
Now, I wish to sum the values in column B depending on a tick being present and also relative to the unique ID in column A. In this case rows 1 and 5. Identifying the tick I use
=IF(ISTEXT(C1),CONCATENATE(A1))
&
=IF(ISTEXT(C1),CONCATENATE(B1)).
This leaves me with two arrays of data:
D E
1 d-45 150
4 d-46 20
5 d-45 70
I now want to sum the values in column E depending on the ID in column D, in this case row 1 and 5. I can use a straight forward SUMIFS statement to specify d-45 as the criteria however this unique ID will always change. Is there a variation of SUMIFS I can use?
I also wish to put each new variation of ID number into a separate header with the summed totals underneath, that is:
A B
1 d-45 d-46
2 220 20
etc...
You can try this:
To get the distinct ID's write (in H1 then copy right):
This one is an array formula so you need Ctrl Shift Enter to enter the formula
=INDEX($A$1:$A$5;SMALL(IF(ROW($A$1:$A$5)-ROW($A$1)+1=MATCH($A$1:$A$5;$A$1:$A$5;0);ROW($A$1:$A$5)-ROW($A$1)+1;"");COLUMNS($A$1:A1)))
Now to get the sum (H2 and copy right)
=SUMPRODUCT(($A$1:$A$5=H1)*ISTEXT($C$1:$C$5)*$B$1:$B$5)
Data in the example is in A1:C5
Depending on your regional settings you may need to replace ";" field separator by ","
Try this,
SUMIFS
=SUMIFS(B1:B5,A1:A5,"=d-45",C1:C5,"<>")
where "<>" means that the cell is not empty...

Resources