Forum Discussion
Gradient Tool
- May 22, 2020
IsaacPiscopo yes sort of. Your formula for grabbing the RIGHT x characters is looking at how many characters are in the 1st section of the RGB code. So you had 3 characters for red so it was taking the last 3 characters instead of only 1. Here is an updated formula:
=IF($E$11>=I6-2,"#"&DEC2HEX((LEFT(I7,SEARCH(" ",I7,1)-1)),2)&DEC2HEX((MID(I7,SEARCH(" ",I7)+1,SEARCH(" ",I7,SEARCH(" ",I7)+1)-SEARCH(" ",I7)-1)),2)&DEC2HEX((RIGHT(I7,LEN(I7)-SEARCH(" ",I7,SEARCH(" ",I7)+1))),2),(""))
I also updated the initial condition to $E$11 and compared it to the numbers above it I6-2 so it would be easy to copy/fill and have excell automatically update all the cells. That said, you MERGED all those cells which disables may useful things in excel. If you want wider cells I recommend just highlighting those columns and dragging them wider or right click and select 'column width'
I attached an updated file but never enabled the macros so they may or may not be attached.
So I changed all the boxes and yeah now the RGB box is broken. I also changed the * part to cell boxes so its better for autofill.(btw I'm using Microsoft Office 365, not to be confused with Microsoft 365)
IsaacPiscopo I believe that formula was also incorrect. At the very least I noticed you had the same error looking at the "right" part of the code but using the left part to determine the number of characters to find.
That said, I think the problem you were seeing was something with your 'math'. I didn't understand what math you were exactly doing so I also changed it to be a weighted average for each color portion.
Although I think the neat trick that Jos_Woolley used could have made the formula more simple, I kept your format since that is what you understand.
- IsaacPiscopoMay 23, 2020Copper Contributor
mtarler is sort of works, it just doesn't work sometimes. Just see for yourself but if you have more acurate, more complicated formulas then be my guest...
- Jos_WoolleyMay 23, 2020Iron Contributor
Re the latest file, which of the results in there are not as you would wish and, importantly, what should they be?
mtarler "Trick" is a bit harsh! "Array manipulation" would be my preferred description! 🙂
- IsaacPiscopoMay 23, 2020Copper Contributor
I9 till O9, they are not actually displaying the colour, but they are giving me the value error