Вот применимый класс на основе того, что сказал Constantin:
class Program
{
static void Main(string[] args)
{
FastConcat<int> i = new FastConcat<int>();
i.Add(new int[] { 0, 1, 2, 3, 4 });
Console.WriteLine(i[0]);
i.Add(new int[] { 5, 6, 7, 8, 9 });
Console.WriteLine(i[4]);
Console.WriteLine("Enumerator:");
foreach (int val in i)
Console.WriteLine(val);
Console.ReadLine();
}
}
class FastConcat<T> : IEnumerable<T>
{
LinkedList<T[]> _items = new LinkedList<T[]>();
int _count;
public int Count
{
get
{
return _count;
}
}
public void Add(T[] items)
{
if (items == null)
return;
if (items.Length == 0)
return;
_items.AddLast(items);
_count += items.Length;
}
private T[] GetItemIndex(int realIndex, out int offset)
{
offset = 0; // Offset that needs to be applied to realIndex.
int currentStart = 0; // Current index start.
foreach (T[] items in _items)
{
currentStart += items.Length;
if (currentStart > realIndex)
return items;
offset = currentStart;
}
return null;
}
public T this[int index]
{
get
{
int offset;
T[] i = GetItemIndex(index, out offset);
return i[index - offset];
}
set
{
int offset;
T[] i = GetItemIndex(index, out offset);
i[index - offset] = value;
}
}
#region IEnumerable<T> Members
public IEnumerator<T> GetEnumerator()
{
foreach (T[] items in _items)
foreach (T item in items)
yield return item;
}
#endregion
#region IEnumerable Members
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
#endregion
}
Ok, I have two ideas for you. Hopefully one of them will get you where you need to go. Note that the first one ignores the request to do this as a formula since that solution is not pretty. I figured I make sure the easy way really wouldn't work for you ;^).
This solution will work with the following caveats:
Here is the summary of the solution:
And here is a step by step example:
Hope this helps....
Вы можете использовать СЧЁТЕСЛИ, чтобы получить количество вхождений значения в диапазоне. Поэтому, если значение находится в A3, диапазон равен A1: A6, тогда в следующем столбце используйте IF (EXACT (COUNTIF (A3: $ A $ 6, A3), 1), A3, ""). Для формата A4 это будет IF (EXACT (COUNTIF (A4: $ A $ 6, A3), 1), A4, "")
Это даст вам столбец, в котором все уникальные значения не дублируются