How do I create this specific chart...?

Hi,


I'm creating an investing portfolio in Numbers, and would like to know how to solve my problem. I am looking to create a chart where the total amount, say 100k this January is one column, which includes the amount I had in December, say 95k, and then my earnings, additions or losses the past month, say 5k.


So, I would like how to make a chart that changes color of the change, say red for negative, and green for positive, and perhaps blue for the neutral, base, previous amount. (95k in the example)


Example:

1st of January: 95k

31st of January: 100k (+5k)


1st of February: 100k

28th of February 95k (-5k)


I assume it's not too complicated, but I am a complete beginner with Numbers and feel like I could sit for hours watching tutorials about stuff without finding this specific detail.


Thanks in advance!

MacBook Air 13″, macOS 14.4

Posted on Feb 5, 2025 6:06 AM

Reply
Question marked as Top-ranking reply

Posted on Feb 5, 2025 10:42 AM

This is doable, but quite complex - at least, it's not intuitive.


The main issue you face is that each series of data on the graph is shown in a single color - it is not possible, for example, to have a single data series change color based on positive or negative values.


Realizing that, you need a way to separate positive (gains) vs. negative (losses) into separate columns.


Here's one way I did it. I used several columns to make the steps clearer, but they could be combined into a single (more complex) function if you prefer:


First, my data:



(yes, I used nice round numbers because I'm OCD)


First observation - there is no need to track 1/31/24 and 2/1/24 since the portfolio value can't change overnight - the value at the last minute of the last day of the month has to exactly match the first minute of the first day of the next month, therefore my data only tracks the 1st of each month.


First step is to calculate the profit/loss on a monthly basis. I did this by adding another column (C) that calculates the difference between the two preceding values in column B:



the formula for C2 is simply 0 (it's our starting point), but the formula for C3 calculates the difference between the portfolio value at the beginning of the previous month (B2) and the current month (B3):


=B3-B2


Fill this formula down the column and you have the profit/loss per month (you may already have this column).


Next step is to add two more columns - one for profits and the other for losses. This simply looks at the Difference column and filters out either positive or negative numbers, as appropriate.



The formula for D2 is simply:


=MAX(C2,0)


This picks the highest value between C2 and 0 - since losses are negative, they get suppressed


Conversely, E2 is:


=MIN(C2,0)


which picks the lower value (profits are suppressed).


Now you have separate columns for profits and losses, and these are what you want to chart.


Select columns A (date), D (profit) and E (loss) and click Chart -> Stacked Column. You should see something like:




Here you can see the profits in blue, and the losses in green. With a little tweaking of the colors and the layout you can get your colors of choice:




2 replies
Question marked as Top-ranking reply

Feb 5, 2025 10:42 AM in response to JGPio

This is doable, but quite complex - at least, it's not intuitive.


The main issue you face is that each series of data on the graph is shown in a single color - it is not possible, for example, to have a single data series change color based on positive or negative values.


Realizing that, you need a way to separate positive (gains) vs. negative (losses) into separate columns.


Here's one way I did it. I used several columns to make the steps clearer, but they could be combined into a single (more complex) function if you prefer:


First, my data:



(yes, I used nice round numbers because I'm OCD)


First observation - there is no need to track 1/31/24 and 2/1/24 since the portfolio value can't change overnight - the value at the last minute of the last day of the month has to exactly match the first minute of the first day of the next month, therefore my data only tracks the 1st of each month.


First step is to calculate the profit/loss on a monthly basis. I did this by adding another column (C) that calculates the difference between the two preceding values in column B:



the formula for C2 is simply 0 (it's our starting point), but the formula for C3 calculates the difference between the portfolio value at the beginning of the previous month (B2) and the current month (B3):


=B3-B2


Fill this formula down the column and you have the profit/loss per month (you may already have this column).


Next step is to add two more columns - one for profits and the other for losses. This simply looks at the Difference column and filters out either positive or negative numbers, as appropriate.



The formula for D2 is simply:


=MAX(C2,0)


This picks the highest value between C2 and 0 - since losses are negative, they get suppressed


Conversely, E2 is:


=MIN(C2,0)


which picks the lower value (profits are suppressed).


Now you have separate columns for profits and losses, and these are what you want to chart.


Select columns A (date), D (profit) and E (loss) and click Chart -> Stacked Column. You should see something like:




Here you can see the profits in blue, and the losses in green. With a little tweaking of the colors and the layout you can get your colors of choice:




Feb 6, 2025 6:42 AM in response to Camelot

Alright, yeah I kinda figured, but what you have shown is more than enough, because two charts besides each other could do the same, if not even more, to aesthetically please me and make it easier to understand. I tried it and am going to play around with it even more, but I appreciate your solution very much! Thank you :)

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How do I create this specific chart...?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.