Hi Sayed Ahmed,
you’re not far off - it seems your problem is with the List.MatchWithKeyValues node rather than with the Math.RemapRange node. It seems MatchWithKeyValues is probably throwing an error, and not passing anything through to RemapRange (which is the reason for your null error).
Is it possible that you intend to GetKeys on the list of unique items, not the full length of the list? If you’re trying to create a colour range that scales with the length of your uniques list, this would make sense
My guess is, you’ll be looking to get a list of evenly-spaced numbers in the range 0-1 in order to generate colours per unique Department type? It would be easy to do this by generating a range; for instance in DesignScript if you wrote 0…1…#x in a code block, then insert the List.Count output (length of your list) into the x-variable input. This would then be plugged into value input on your Color Range node.