change the color and make bold the result in excel formula - excel-formula

How do I make the color of result "&O4&" green and the color of the result of "&P4&" red?
Here is the formula: ="Present: "&" "&O4&" Times"&" "&" Absent:"&" "&P4&" Times"
Here is the result: Present: 4 Times Absent: 0 Times
I want 4 to be green and 0 to be red in color and bold

Related

Power Query to sum for each color and each size, return a value on the available size list

I have a list of shirt colors and the suggested sizes of them. I would like to create a new column in the query and have a value of list based on the filtered elements ( I have no idea how to explain it differently, feel free to correct me). So the rules are:
If the current color has XS in the occurrence list then the value of the row needs to be "YES"
If the current color does not have XS but has XXL,XL or L then the value should be "XYES"
Otherwise the value needs to be "NO"
Jacket Color
Jacket Size
Black
XS
Black
XS
Black
S
Blue
XS
Blue
L
Blue
XL
Blue
XXL
Blue
XL
Blue
XXL
Green
XS
Green
S
Green
M
Red
XS
Red
XXL
Red
S
Red
XXL
White
S
White
M
The table should look like this:
Jacket Color
Jacket Size
New_col
Black
XS
YES
Black
XS
YES
Black
S
YES
Blue
XS
XYES
Blue
L
XYES
Blue
XL
XYES
Blue
XXL
XYES
Blue
XL
XYES
Blue
XXL
XYES
Green
XS
YES
Green
S
YES
Green
M
YES
Red
XS
XYES
Red
XXL
XYES
Red
S
XYES
Red
XXL
XYES
White
S
NO
White
M
NO
I am not that big of a tech guy myself, if you can help me how to google the answer, that is good aswell.Thank you in advance.
Tried everything I could with this little knowledge I have about power query. If this could be solved by me, I would have a job right now.
Your result data doesn't match your sample data but this is the process.
Import data in PQ
Select Jacket Color and then group by from the ribbon. Enter the following:
Add a new custom column from the ribbon and enter the following:
if List.Contains([All][Jacket Size], "XS") then "Yes" else if List.ContainsAny([All][Jacket Size], {"XXL","XL", "L"}) then "XYES" else "No"
Expand the column to get all rows back.

Background color of table cell changes depending on 2 conditions

i would like to change the background color of a cell. The change will depend on 2 conditions, if the final value of cell is >20 then green, if less than -20 then red.
table.cell(panel, 5, 0, str.tostring(finalvalue), bgcolor=close>20?color.green:color.red)'
I managed the first condition but how can I add the second condition pls
Thanks in advance
bgcolor=close>20?color.green:color.red)
Will change the backround to green if the close price is above 20 and to red otherwise.
What you need is a second ternary operator in this condition.
bgcolor = finalvalue > 20 ? color.green : finalvalue < -20 color.red : color.yellow)
In this statement, the background will be green if finalvalue is greater than 20, and it will be red if it is less than -20 and it will be yellow if it is in between.

Excel - Overlapping Data - Pivottable

Is it possible to create a table for data with overlapping values within the same column?
I would prefer a pivot table where I could slice the data instead of Venn Diagram.
Data
1. Red / Material 1
2. Red / Material 2
3. Red / Material 3
4. Red / Material 4
5. Red / Material 5
6. Blue / Material 1
7. Blue / Material 6
8. Blue / Material 7
9. Blue / Material 8
10. Blue / Material 9
11. Blue / Material 10
12. Blue / Material 11
13. Blue / Material 12
14. Green / Material 1
15. Green / Material 2
16. Green / Material 6
17. Green / Material 7
18. Green / Material 8
19. Green / Material 13
20. Green / Material 14
First, create a table that has combinations of colors like this:
Color Color2
-------------
Red Red
Red Blue
Red Green
Blue Red
Blue Blue
Blue Green
Green Red
Green Blue
Green Green
One way to do this is to created a calculated Colors table like this:
Colors = CROSSJOIN(SELECTCOLUMNS(VALUES(Data[Color]), "Color", Data[Color]),
SELECTCOLUMNS(VALUES(Data[Color]), "Color2", Data[Color]))
Now we can create a calculated column on this table that counts the intersecting values:
Count =
VAR Materials1 = CALCULATETABLE(VALUES(Data[Material]),
Data[Color] = EARLIER(Colors[Color]))
VAR Materials2 = CALCULATETABLE(VALUES(Data[Material]),
Data[Color] = EARLIER(Colors[Color2]))
RETURN IF(Colors[Color] = Colors[Color2], BLANK(),
COUNTROWS(INTERSECT(Materials1, Materials2)))
Now you can set them up in a matrix visual with Color on the Rows and Color2 on the Columns and Count in the Values box.

Excel sort by similar cell data

So I have this list of data that i need to compare 2 spreadsheets with. Im going to simplify it with a list like below(Column A being a part number, and column B being a quantity):
Spreadsheet 1:
Red 1
Blue 2
Green 1
Orange 6
Yellow 8
Spreadsheet 2:
Red 1
Green 1
Blue 2
Orange 6
Yellow 8
Silver 2
Brown 3
Now what i would like my output to be:
Red 1
Blue 2
Green 1
Orange 6
Yellow 8
Silver 2
Brown 3
Notice that im sorting it so that list 2 aligns with list one, and if list 2 contains things that are not on list 1 it puts it at the bottom(preferably vice-versa compatible). Im not sure if this is even possible, but if it is it will GREATLY decrease my workload so any help is MUCH appreciated. Thanks for your time!

excel data transposition using built in formulas

Heres the issue I have a dump from the database at work that is in a rather conveluted format. Basically it does not give you the displayed information as much as just the individual relation tables to work with.
EXAMPLE: lets say I have the following columns of information
ID, COLOR, SIZE, QTY, TYPE
the information looks something like this
ID COLOR SIZE QTY TYPE
A brown 20 1 1
C yellow 10 2 2
D brown 40 5 1
A blue 70 1 3
A yellow 80 1 2
B yellow 20 4 1
D blue 70 4 2
C blue 10 3 1
what i need is something more like this
ID BROWN SIZE TYPE BLUE SIZE TYPE YELLOW SIZE TYPE
A 1 20 1 1 0 3 1 80 2
B 0 0 0 0 0 0 4 20 1
C 0 0 0 3 10 1 2 20 1
D 5 40 1 4 0 2 0 0 0
I most like could accomplish this with an excel formula, possibly the one called sumifs but i can not seem to get it to work any help with this would be greatly appriciated.
You can do this by using a combination of SUM and IF in array formulas.
Assuming that your data table starts in cell A1 and your result table starts in cell A11, begin by entering the following formulas in cells B12, C12 and D12 respectively, making sure to use the CONTROL-SHIFT-ENTER key combination to enter them.
B12 =SUM(IF($B$2:$B$9=B$11,IF($A$2:$A$9=$A12,$D$2:$D$9,0)))
C12 =SUM(IF($B$2:$B$9=B$11,IF($A$2:$A$9=$A12,$C$2:$C$9,0)))
D12 =SUM(IF($B$2:$B$9=B$11,IF($A$2:$A$9=$A12,$E$2:$E$9,0)))
Copy the cells down to the bottom of your data table, which in this example would be row 15.
Then copy the block of formulas you have created to cell E12, where the BLUE section of the result table starts. Then copy the same block of formulas to cell H12, where the YELLOW section of the result table starts.
This solution assumes that you have no duplicate combinations of ID and COLOR in your data table and that no combinations are missing. If there are missing combinations of ID and COLOR, you would need to wrap the formulas in an IFERROR function (in Excel 2010).
The way I'd transpose a data table would run like this...
Your example is a bit more complicated so I'm not going to use your full data, just go with size. Begin by creating a column called Index
A B C D
INDEX ID COLOR SIZE
=A3 & "-" & B3 A brown 20
=A4 & "-" & B4 C yellow 10
. D brown 40
. A blue 70
. A yellow 80
. B yellow 20
D-blue D blue 70
C-blue C blue 10
Create a table equivalent which combines the header row with the ID column
F G H I
ID brown blue yellow
A =$F2 & "-" & G$1 . .
B . . .
C . C-blue C-yellow
D . D-blue D-yellow
Finally wrap this up in a VLOOKUP or an OFFSET(MATCH(_)) with possible an IFERROR
ID brown blue yellow
A =IFERROR(VLOOKUP($F2 & "-" & G$1,$A$3:$D$10,4,FALSE),"Err")
B . . .
C . 10 10
D . 70 Err
Anyway that is how I generally do this sort of transform

Resources