pivot table help in excel to get a tree map - excel

i need help in resolving a time consuming job
Input example
part number
where used
a
d
a
l
b
e
c
f
d
g
d
m
g
h
f
i
h
j
l
k
Result tree i need:
a
d
g
h
j
a
l
k
i am using pivot tabe to get this, but i cant arrive at that, kindly provide your guidance to make it

Related

How to add line in code in python console

How to add new line in python. for example, I would like to print the rest of a sentence in a new line. but instead of putting "\n", I will automate it to type to a new line for every six words.
Morse code translator
sth like:
def wrapper(words, n):
to_print = ''
for i in range(0, len(words.split()), n):
to_print += ' '.join(words.split()[i:i+n]) + '\n'
return to_print
and result is:
print(wrapper('a b c d e f g h i j k l m n o p r s t u w x y z', 6))
a b c d e f
g h i j k l
m n o p r s
t u w x y z

Sumproduct nested inside countifs

Am trying hard to crack this excel formula but need help. Basically I need count of all "p" & "f" on from different column ranges+rows (Status 1-4), if one the corresponding row value (Site) is "CH". Here is what the data looks like.
Status 1 Status 2 Status 3 Status 4 Site
P f n t CH
P f n t DL
P P P P BD
f f P P CR
f f f f CH
P P f f DL
P P P P BD
t t t t CR
t t t t CH
P f n t DL
P f P f BD
P f P f CR
P P P P CH
Any quick help will be much appreciated. I tried formula - =Countif(E2:E14,"CH",SUMPRODUCT(COUNTIF(A2:D14,{"p","f"}))), of course I knew that's wrong!
You need to combine several countifs that have OR conditions and sum them all up, for example like this:
=SUM(COUNTIFS($E$2:$E$14,"CH",A2:A14,{"p","f"}),COUNTIFS($E$2:$E$14,"CH",B2:B14,{"p","f"}),COUNTIFS($E$2:$E$14,"CH",C2:C14,{"p","f"}),COUNTIFS($E$2:$E$14,"CH",D2:D14,{"p","f"}))
You don't specify the expected result, but according to your written logic, it should be 10 and the formula returns just that.
Here is another approach. As much as I like to avoid INDIRECT, sometimes it is necessary.
=SUMPRODUCT(COUNTIFS(E2:E999, "CH", INDIRECT(ADDRESS(2, ROW(1:4), 4, 1)&":"&ADDRESS(999, ROW(1:4), 4, 1)), {"f","p"}))

python3 - create list of strings elliptically

EDIT: I do not want your code! just help me think of a nice way to do it :)
I have a string with 25 characters:
ABCDEFGHIKLMNOPQRSTUVWXYZ
and I want to create a matrix5*5 given a position and a direction,
position can be one of the corners and direction can be clock or counter clock.
so if I gave this arguments:
create((0,0), clock)
I want to recive:
["ABCDE", "QRSTF", "PYZUG", "OXWVH", "NMLKI"]
and I could then print it and recieve:
A B C D E
Q R S T F
P Y Z U G
O X W V H
N M L K I

Split a single row of data (dat file) into multiple columns

I want to split a row of data into multiple columns like
a.dat
A B C D E F G H I J K L M N O P Q R S T U
into
b.dat
A B C D E F G
H I J K L M N
O P Q R S T U
I have tried using the pr function
pr -ts" " --columns 7 --across a.dat > b.dat
But it doesn't work, b.dat is the same as a.dat
I like fold for these thingies:
$ fold -w 14 file
A B C D E F G
H I J K L M N
O P Q R S T U
With -w you set the width you desire to have.
Although xargs is more useful if you want to split based on number of fields instead of characters:
$ xargs -n 7 < file
A B C D E F G
H I J K L M N
O P Q R S T U
Regarding your attempt in pr: I don't really know why it is not working, although from some examples I see it doesn't look like the tool for such job.

Count if excel not working for letter C

My count if function won't work for the letter "C". I checked for spaces with len function and I am super confused. Thanks for the help.
#of Accident Type
A 28
B 19
C =COUNTIF(A2:A101, "*C*")
D 17
E 9
F 9
Accidents
A
B
D
A
A
F
C
A
C
B
E
B
A
C
F
D
B
C
D
A
A
C
B
E
B
C
E
A
B
A
A
A
B
C
C
D
F
D
B
B
A
F
C
B
A
C
B
E
E
D
A
B
C
E
A
A
F
C
B
D
D
D
B
D
C
A
F
A
A
B
D
E
A
E
D
B
C
A
F
A
C
D
D
A
A
B
A
F
D
C
A
C
B
F
D
A
E
A
C
D
Seems to work fine, but I did not put the asterisks. Each cell (copied form the data example you gave) only has the character : no spaces...
Probably it does not work, because the C is written in Cyrillic. To make sure, whether this is the case, write C in English additionally and try to change the font to something Fancy - e.g. Algerian. Then the two C will be obviously different:
=COUNTIF(A2:A101,"*C*" )
For some reason its working now... I changed the font and messed around with it.
Thanks again for the help!!!!

Resources