0

So I am trying to create a bar chart in excel to show sleep data.

I have 3 columns of data Date, Time, and Observation.

Observation has 3 possible values (1-3)

1 = Asleep 2 = Awake 3 = Away

https://i.sstatic.net/xCknh.png

I am wanting to end up with a bar graph that has a bar for each date with the time on the x-axis. The color of the bar should change based on the 1-3 value.

Blue = Asleep Green = Awake Orange = Away

The end result should look something like this.

https://i.sstatic.net/HM3z0.jpg

Is this possible in excel or is there any other way to do it?

1 Answer 1

0

Stacked bar charts may work for you, but I think each series stack on top of the previous. So it will be difficult to organise your data. Say you have wake, sleep, wake, away, sleep. Those would have to each been in its own column and all would be different colours. You would have to manually set all the wakes/etc to the same colour.

For this problem, I would rather just use the cells itself with conditional formatting to colour it, create a "chart" for cells. An easy starting point may be to modify a free "excel gantt chart templates". E.g. like this enter image description here

This is the first one that popped up in google images.

It wouldn't be too difficult to set up with your own formulae either. Each cell in the "chart" would look up the date first using the MATCH function. Then search for the closest time in ascending order using MATCH(...INDEX(...use result from first MATCH...)). Then return the observation INDEX(...use result from second match...). Now you have a table with 1, 2 and 3's. Use conditional formatting to set both the text color and the background colour to the same colours as required, so you only see a coloured block, not the text inside the block.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .