Feb 19 2024 02:34 AM
Hello,
I am adding automated commentary at the front of my excel report. Does anyone know how disply numbers with a "+" in front of them if it positive? The negative values come out as "-" using the formula below, but I want the positive numbers to add a "+" before them. Even better if the numbers came out as red or green.
Formula ="1. UG: "&TEXT(AR16,"#%")&" vs. LY ("&TEXT(AS16,"#%")&" LW); "&TEXT(AT16,"#%")&" vs target ( "&TEXT(AU16,"0")&" AFP+) "
Current Display: 1. UG: 5% vs. LY (-2% LW); -32% vs target ( -58 AFP+)
Wanted Display: 1. UG: +5% vs. LY (-2% LW); -32% vs target ( -58 AFP+)
Thanks so much for your help!
Feb 19 2024 03:01 AM
Feb 19 2024 03:08 AM
SolutionAs @JKPieterse mentioned, it is not possible to color the numbers, but you can change the number format:
="1. UG: "&TEXT(AR16, "+0%;-0%")&" vs. LY ("&TEXT(AS16, "+0%;-0%")&" LW); "&TEXT(AT16, "+0%;-0%")&" vs target ("&TEXT(AU16, "+0;-0")&" AFP+)"
Feb 19 2024 03:08 AM
Here are two ways to achieve the desired formatting for positive and negative values in your Excel formula:
1. Using Conditional Formatting:
2. Using a Custom Formula:
This formula uses the IF function to check if the value in AR16 is greater than 0. If true, it adds a "+" sign and then formats the number using the percent format code. If false, it simply formats the number without the "+" sign.
You can replicate this structure for the other cells (AS16, AT16, and AU16) within your formula, adjusting the cell references accordingly.
Choosing the Right Method:
Remember to adjust the cell references and formatting options in these examples to match your specific needs.
Feb 19 2024 03:08 AM
SolutionAs @JKPieterse mentioned, it is not possible to color the numbers, but you can change the number format:
="1. UG: "&TEXT(AR16, "+0%;-0%")&" vs. LY ("&TEXT(AS16, "+0%;-0%")&" LW); "&TEXT(AT16, "+0%;-0%")&" vs target ("&TEXT(AU16, "+0;-0")&" AFP+)"