Skip to content

Instantly share code, notes, and snippets.

@Greedquest
Greedquest / ANALYSIS
Created February 16, 2024 12:30
ANALYSIS Custom Excel LAMBDA module
/**Provides column statistics for values in a table*/
COLUMNPROFILE = LAMBDA(
Table,
[max_display_values],
[value_trim_threshold],
BYCOL(
Table,
LAMBDA(col,
LET(
max_display_values, IF(
digraph G {
style=filled;
bgcolor=gray95
node [fontsize = 12 fontname = calibri style=filled fillcolor=white]
edge [fontsize = 10 fontname=Consolas decorate=true fontcolor=gray50]
key [shape=Mrecord fillcolor = gray95 color=gray20 style=filled label="{KEY|Blue (R): Refreshable|Green (Rb): Refreshable returns\na boolean success|Orange (C): Cancellable refresh|Red (D/Dd): Delete-able\n(including connection)|Black: Standard|NOTE: Some nodes fall in several categories,\nonly the most important one is shown.|NOTE: Edges are labelled with 'many' to indicate\na collection, and sometimes 'one'\nto disambiguate (default is one if unspecified).}"]
@Greedquest
Greedquest / SET
Last active September 20, 2023 12:31
SET Custom Excel LAMBDA module
/**Differences between 2 sets*/
DIFFERENCE = LAMBDA(a, b,
UNIQUE(VSTACK(UNIQUE(a), UNIQUE(b)), , TRUE)
);
/**Intersection of 2 sets (elements in both)*/
INTERSECT = LAMBDA(a, b,
DIFFERENCE(VSTACK(a, b), DIFFERENCE(a, b))
);
@Greedquest
Greedquest / RD3 Architecture.gv
Last active November 10, 2022 14:49
RD3 architecture diagram
graph RD3 {
graph [fontsize=10 fontname="Verdana" compound=true];
node [fontsize=10 fontname="Verdana"];
subgraph vbe_client{
vbe [label="VB6/VBA Editor"]
vbe -- typelibs
lsp_tool [label="VBE LSP Client (tool)"]
lsp_tool -- rd_extensibility
@Greedquest
Greedquest / Demo.md
Last active November 14, 2022 01:41

ARGSCOUNT function

=LAMBDA([p_1],[p_2],[p_3],[p_4],[p_5],[p_6],[p_7],[p_8],[p_9],[p_10],[p_11],[p_12],[p_13],[p_14],[p_15],[p_16],[p_17],[p_18],[p_19],[p_20],[p_21],[p_22],[p_23],[p_24],[p_25],[p_26],[p_27],[p_28],[p_29],[p_30],[p_31],[p_32],[p_33],[p_34],[p_35],[p_36],[p_37],[p_38],[p_39],[p_40],[p_41],[p_42],[p_43],[p_44],[p_45],[p_46],[p_47],[p_48],[p_49],[p_50],[p_51],[p_52],[p_53],[p_54],[p_55],[p_56],[p_57],[p_58],[p_59],[p_60],[p_61],[p_62],[p_63],IF(ISOMITTED(p_32),IF(ISOMITTED(p_16),IF(ISOMITTED(p_8),IF(ISOMITTED(p_4),IF(ISOMITTED(p_2),IF(ISOMITTED(p_1),0,1),IF(ISOMITTED(p_3),2,3)),IF(ISOMITTED(p_6),IF(ISOMITTED(p_5),4,5),IF(ISOMITTED(p_7),6,7))),IF(ISOMITTED(p_12),IF(ISOMITTED(p_10),IF(ISOMITTED(p_9),8,9),IF(ISOMITTED(p_11),10,11)),IF(ISOMITTED(p_14),IF(ISOMITTED(p_13),12,13),IF(ISOMITTED(p_15),14,15)))),IF(ISOMITTED(p_24),IF(ISOMITTED(p_20),IF(ISOMITTED(p_18),IF(ISOMITTED(p_17),16,17),IF(ISOMITTED(p_19),18,19)),IF(ISOMITTED(p_22),IF(ISOMITTED(p_21),20,21),IF(ISOMITTED(p_23),22,23))),I
@Greedquest
Greedquest / IEEE754.bas
Last active July 7, 2021 14:31
VBA get special double values like +- inf and NaN
Attribute VB_Name = "IEEE754"
'@Folder("Tests.Utils")
'Modified from https://stackoverflow.com/a/896292/6609896
Option Explicit
Public Enum abIEEE754SpecialValues
abInfinityPos
abInfinityNeg
abNaNQuiet
abNaNSignalling
@Greedquest
Greedquest / COMHelper.bas
Last active May 23, 2021 20:02
VBA Get Standard Module Accessor Object proof of concept
Attribute VB_Name = "COMHelper"
'@Folder "TypeInfoInvoker"
Option Private Module
Option Explicit
Private Type GUID
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(0 To 7) As Byte
@Greedquest
Greedquest / TwoDimensionalMapping.cls
Last active December 18, 2019 16:47
Two way key<->value mapping in VBA
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "TwoWayMapping"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'@Folder("Operator Framework.Common")
@Greedquest
Greedquest / WinAPI.bas
Created August 31, 2019 17:28
Some WinAPI declarations to help debug message loop & window related stuff
Attribute VB_Name = "WinAPI"
'@Folder("WinAPI")
Option Explicit
Option Private Module
Public Type tagPOINT
X As Long
Y As Long
End Type
@Greedquest
Greedquest / SOTest.bas
Last active July 22, 2019 10:08
Example code to check whether Peek finds Posted messages
Option Explicit
Public Const PM_REMOVE As Long = &H1
Public Const PM_NOREMOVE As Long = &H0
Public Type tagPOINT
x As Long
y As Long
End Type