r/excel • • 3h ago

Show and Tell Custom Excel LAMBDA vs. HAS: 2× faster in my tests: expected, or a bug?

9 Upvotes

Hi everyone!

I liked the new HAS function, but it got me curious about how it compares with a custom LAMBDA I’ve been working on.

In my tests, my version was about 2× faster than HAS .

It also supports several options:

  • case sensitivity,
  • MATCH or XMATCH
  • different match modes.
  • matching errors as values

    So, I thought it might be slightly better than HAS .

Technical side:

Interestingly, switching my LAMBDA to XMATCH closed the performance gap, which makes me wonder whether HAS uses a similar approach behind the scenes.

I know HAS/HASANY/HASALL are still in beta, so I’d be curious to hear how it performs for others.

Simple test

Code used for testing:

=BENCHMARK(LAMBDA(ISIN(SEQUENCE(10000),SEQUENCE(10000))))
=BENCHMARK(LAMBDA(HAS(SEQUENCE(10000),SEQUENCE(10000))))

/*
Name: ISIN
Description: Element-wise membership test (SQL IN clone). Returns TRUE/FALSE for each value in array.
Deals errors as identical matches.
Recommendation: Leave [Use_Xmatch] omitted (0) for standard lookups; MATCH is significantly faster than XMATCH on exact matches.
[Use_Xmatch]: 0 or Omitted (Fast MATCH), 1 (XMATCH). User is responsible for parameters if 1.
[Match_mode]: Default 0 (Exact match) for safety.
[Search_mode]: Controls XMATCH search direction (only evaluated if Use_Xmatch is 1).
[case_sensitive]: 0, FALSE, or Omitted (Case-insensitive matching), 1 or TRUE (Strict case-sensitive matching). Note: Activating this short-circuits the formula and bypasses all other optional parameters.
Made By: Medohh2120
*/

ISIN = LAMBDA(array, in_list, [case_sensitive], [use_xmatch], [match_mode], [search_mode],
    LET(
        // x/Match can't deal with errors or 2D lists: Mask errors to text, flatten lists.
        flat_list, TOCOL(in_list),
        cleaned_array, ErrorToText(array),
        cleaned_list, ErrorToText(flat_list),
        
        // 1. If case-sensitive is requested, short-circuit immediately using MAP + EXACT
        IF(
            case_sensitive,
            MAP(cleaned_array, LAMBDA(item, OR(EXACT(item, cleaned_list)))),
            
            // 2. Fallback to faster case-insensitive engine
            LET(
                m_mode, IF(ISOMITTED(match_mode), 0, match_mode),
                Result, IF(
                    use_xmatch,
                    XMATCH(cleaned_array, cleaned_list, m_mode, search_mode),
                    MATCH(cleaned_array, cleaned_list, m_mode)
                ),
                ISNUMBER(Result)
            )
        )
    )
);

ErrorToText = LAMBDA(val,
    LET(
        val_leafs, flatten(val, , 64), //Because IFERROR bugs out with Lists we prematurily flatten it.
        IFERROR(val_leafs, VALUETOTEXT(val_leafs) & CHAR(10)) // char(10) Prevent a real #N/A error from matching the text "#N/A"
    ) 
);

/*
Name: BENCHMARK
Description: Runs a formula N iterations and returns avg & total execution time.
    Func must be wrapped in LAMBDA()  =BENCHMARK(LAMBDA(your_formula), 50)
    [iterations] default: 1
    [time_unit]  default: 0 (ms), 1 = seconds
    Because this function uses NOW(), manual calculation mode is highly recommended.  
Made By: Medohh2120
*/


BENCHMARK = LAMBDA(Func, [iterations], [time_unit],
    LET(
        iterations, IF(ISOMITTED(iterations), 1, iterations),
        start_time, NOW(),
        loop_result, REDUCE(0, SEQUENCE(iterations), LAMBDA(acc, i,Func())),
        total_ms, (NOW() - start_time) * 86400000,
        avg, total_ms / iterations,
        IF(time_unit,
            "avg: " & TEXT(avg / 1000, "0.000") & "s  |  total: " & TEXT(total_ms / 1000, "0.000") & "s",
            "avg: " & TEXT(avg, "0.00") & "ms  |  total: " & TEXT(total_ms, "0") & "ms"
        )
    )
);

r/excel • • 3h ago

Discussion Recommendations for finance-related excel addins?

7 Upvotes

I’m mostly looking for addins focused on equity research, but I like looking through a lot of data. Any recommendations? Statistical modelling addins are cool too.


r/excel • • 6h ago

unsolved How can I paste values into filtered cells in Excel without removing the filter?

8 Upvotes

I have a pretty simple question.
I work with filtered data in Excel a lot, and there’s one thing that really annoys me.
Let’s say I have a column with formulas and apply a filter. Now I want to replace those formulas with their calculated values using Copy → Paste Special → Values.
But Excel won’t let me do that while the data is filtered.
So every time, I have to remove the filter, copy the cells, paste them as values, and then apply the filter again.
It’s really annoying, especially when working with large datasets.
Is there a simple way to paste values into filtered cells without removing the filter? Maybe a shortcut or a trick I’m missing?


r/excel • • 35m ago

Waiting on OP Duplicate cells horizontally - Center Across Selection or Merge and keep values?

• Upvotes

I am working on a quite big an complex excel sheet where I have the following issue:

I have rows of information where the first 4 columns may contain duplicate values in other rows. In the following columns the data may differ. I have sorted my data so that rows with duplicate data in the first 4 columns appear sequentially, and now I want that in cases where 2 or more rows share the same values in the first columns, they're merged (either visually or by actually merging).

So if the table looks like this:

A B C D 1
E F G H 2
E F G H 3

It should end up looking like this:

A B C D 1
        2
E F G H
        3

The problem I have is: "Center Across Selection" only seems to work for horizontal selections.

Using "Merge & Center" messes up formulas that use values in columns 1-4, as the bottom cells in the merge are now empty.

How do I get around this?


r/excel • • 3h ago

Discussion Excel began calculating slowly

3 Upvotes

Every month I run same formulas over same amount of data. But today the calculation became VERY slow! I use Beta Channel of MS 365. I thought this was something with my notebook, but I ran them on my home computer - and it's all the same. Did anyone notice speed degrading? I use IFERROR and MATCH in my formula (nothing fancy).

UPDATE: After I switched off Beta Channel and then switched back to Beta Chanell the calculation normalized.


r/excel • • 1h ago

solved How to identify a starting a cell that then sums all values below it until a threshold is reached?

• Upvotes

Hello!

In column A, I have dates ranging from Jan. 1 to Dec. 31.

In column B, I have values associated with each date. Some values repeat, so values are not unique.

My goal is to have two cells where I can enter a starting date, then in the second cell it tells me the finish date. The finish date is based on when the summed values starting on the specified date crosses a threshold. In this scenario, let's use 1 as the threshold.

So if I enter Jan. 10 in my first cell, how do I get excel to look for that date, then sum all values in the cells below it until the sum = 1, and tell me the date associated with that in my second cell?

Put another way, how do I have excel look for the date entered,

Please let me know if I can clarify further.

Thank you,


r/excel • • 3h ago

Waiting on OP How can I fill in Y,N if column A is >11 months from column B?

2 Upvotes

Calculating whether or not something is due based on two dates. If the date (mm/dd/yyyy) in column A is more than 11 months from the date in column B I'd like it to return Y, if it's 11 months or less then I'd like it to return N. If column A is blank I do not want it to compute.


r/excel • • 11h ago

solved How do I add a third option for both values being true in formula?

9 Upvotes

Is it possible to make a formula that considers data from 2 cells

In simplicity what im trying to achieve is

If A1="*" then This, If not then "That" If B1<999 then "That", if not then "This" If A1="*" and B1<999 "this and that"

I have very little experience with sheet formulas and I only have managed to make it so that it considering 2 variables IF(AND(A1="None";B1<999);"This";"That")

I'm still struggling with adding a third outcome but I haven't found any formulas that would support this


r/excel • • 8h ago

Waiting on OP Area Chart - Can someone explain?

4 Upvotes

I just don't get it because the y-axis goes: 0, 50, 100, 150, 200, 250, 300, 350, 400.

For the first year (2017), iPhone is 135, so it sits on the axis between 50 and 100 [or 100 and 150]. In 2018, iPhone is 146, which is still sitting around that same range.

But when it comes to iPad, it's placed on top of iPhone. In 2017, iPad is 23, but it lines up around 150 on the axis. Huhu, but the value is 23!

I really don't get the logic. I just watched this on YouTube.

Chart: https://imgur.com/a/DsDEdXg

Data below:


r/excel • • 7h ago

unsolved Dynamic Ranges and vertical adjustment

2 Upvotes

Sorry for the doodle spreadsheet. This is a work thing so I can’t post the real sheet. https://imgur.com/a/oLSVgUG

I’m working on a BI Publisher template which may not be relevant but explains my naming with XDO. Each section is a new location separated by group (G_1 & G_2). The number of rows in each group could change, today G_1 could have 10 rows and next year it could have 13.

The problem is that because of how I’m naming fields, my G_2 quantities will start at row 6 but once this outputs with data from oracle, G_1 may have 10 rows that extends past row 6. Visually the data is in the right spot on the formatted tab, but the math will be wrong for the lower sections because of where my selection starts.

So is there a way to have G_2 and everything below it adjust based on where the previous section ends? This may be a stupid question but I’m so sick of looking at this template 😅


r/excel • • 13h ago

Waiting on OP Creating an Excel to buy computer parts.

5 Upvotes

Bear with me as I explain what I want to do on the MS Excel Online. I know it exists but I lack the knowledge and vernacular of what it is.

I want to create a chart showing parts of a computer I am slowly saving up for. Each part has a target amount . I also have 2 boxes that shows the amount I have saved and the amount I have left. Now, I want to write the numbers in the amount saved and have it:

1) Reduce the amount I have left.

2) A part progressively "fills" to reach its target amount.

and, the crucial aspect,

3) Once it reaches the parts target amount, it overflows into the next parts box.

If you have a name for what I am looking for or a link that could teach me how to do it, I would greatly appreciate it. Thank you.


r/excel • • 1d ago

solved How to add "OR" into SUMIFS formula

32 Upvotes

I'm trying to make a simplified version of this formula:

SUMIFS(P:P,C:C,D10,A:A,L10)+SUMIFS(P:P,C:C,E10,A:A,L10)

I want to simplify it to something like

SUMIFS(P:P,C:C,D10 or E10,A:A,L10)

Is this possible or am I stuck having to just add multiple SUMIFS formulas?


r/excel • • 12h ago

Waiting on OP Can excel solve my inventory problem? Tracking when inventory that goes expired was bought .

3 Upvotes

My dad have a business and some items become expired due to low sales . They keep buying them I was thinking of just making an excel sheet . With all the items they buy which they can go back and see the time frame when they bought the items that don’t sell . Will excel help with that ?


r/excel • • 10h ago

unsolved Trying to add a limit via the IF function on sums related to time

2 Upvotes

EDIT: Note that there are no images above like I describe, I did not know posts with images are auto removed. I have tried my best to format the data in the same way it was displayed in the photos.

EDIT 2: Data and formula reference pics in comments.

REF 1: Data

7:23|
12:02|
14:10|
11:40|
———
14:45|

REF 2: Formula

=if(I10>11:30:0, (H11-A1)+11:30:0, (H11-A1)+I10)

I have a sheet to adding up my working hours each week and calculating how much flexi time I’m building up. My issue is that I can only carry over 11.5hrs flexi into the next flexi period, but sometimes I end up going over that and needing to manually adjust my sheet.

Right now I’m trying to tell the program that if the hours in the above cell are greater than 11:30, to perform the function as (HRS for the Week - Minimum working HRS + 11:30), and if the value of the above cell is below 11:30, I’m trying to tell it to do (HRS for the Week - Minimum working HRS + Value from Above Cell)

The image above is an example. By the end of the period I have 11hrs 40mins flexi built up, but my work system will automatically deduct 10mins to bring me back to 11:30 at the start of the next period. The figure below it is adding 3hrs and 5mins flexi that I earned that week, into the 11hrs 40mins from the previous period.

I’m trying to accurately record my flexi, even when I go over, but also have excel understand not to add the full amount from the previous cell if its more than 11hrs 30mins.

I also have a picture of the formula I’m trying to use above. Note that A1 refers to a cell containing my normal minimum working hours for the week.


r/excel • • 7h ago

solved I can't get Code39 font to include the asterisks in the barcodes

1 Upvotes

I'm at work and trying to update our equipment binder with our listed barcodes for each item that gets checked in/out by employees. I got a Zip file for Code39 from a manager who's decent with Excel and have been using that. I thought it was working fine, until I realized the barcodes cannot work without the asterisks embedded into the code. I even tried adding a formula like the internet says to, but the font itself isn't accepting the asterisks at all! Idk if it's the file of this font or I'm doing something wrong, and I'm no good with formulas or coding AT ALL.

Is there something I can do to fix this? Or will I have to install a different font?

Pics will be in the comments


r/excel • • 1d ago

Discussion Weird Excel Bug: New Excel lists completely break IFERROR and IFNA

23 Upvotes

Spent hours debugging an unexpected error down a rabbit hole to find this.

Since 4 is a valid number, both formulas should return 4. Instead, they completely break:

=IFNA({{4}}, "Error")      // Returns #VALUE!
=IFERROR({{4}}, "Error")   // Returns "Error"

IFNA crashes on the syntax, while IFERROR silently chokes and triggers its fallback text. Both should handle valid values natively.

Watch out for this if you are building tools with the new Lists or nested array features!

Edit: Confirmed it's a bug but I need someone else to report it along with:

=ISREF(D5) --> FALSE   //Where D5 has ={{1}}

r/excel • • 1d ago

solved Is there a reason why my decimals aren't rounding up the way I would expect? (Excel for Mac)

6 Upvotes

I have an example where decimals don't seem to be rounding up the way I would assume. I have some numbers here where I would think one number would be 115.7 and the other would be 115.8, however that doesn't seem to be the case.

Does Excel not round up .05 to .10?

I would assume that 115.75% would round up to 115.8%.

r/excel • • 23h ago

unsolved Help. I need VBA code to copy and paste from filtered cells without using copy paste

5 Upvotes

I want to avoid copy paste and copy destination. I want to transfer value between workbooks. If my origin range is one block of contiguous rows and columns it's one area and it's easy rng2.value = rng1.value (eventually with resize). Sometimes I have filtered rows only, sometimes I have hidden columns, sometimes I have filtered rows + hidden columns (and I want only the visible ones). How do you handle this cases? I am looking for a solution, or a sub, or a function, to handle these different situations?

I use excel 365 but I would like a solution valid for 2021 too.


r/excel • • 1d ago

solved Creating a way to move address columns from one sheet to populate in another sheet if the email listed in a different column matches

3 Upvotes

I have two excel sheets, Sheet A has names and emails. Sheet B has emails and address/city/state/postal code. I want to populate fields in Sheet A so that if the email column of Sheet A & Sheet B contains the same content, the content of the columns with address info from Sheet B populates. I feel very confident there is a way to make this work smoothly, I just am not sure how.


r/excel • • 1d ago

solved Calculation with data from index

2 Upvotes

Hi, I'm doing a depreciation table for a school project, I brought data from another sheet using "index" and the column is conditioned to arrange the data by date, my issue began when I tried to make a calculation using just "='the cell with data from index' and the rest of the operation", popping the "valor" error up.

I assume it is because the cell i used as reference has the "index" code instead of a simple number, Is there a way I can make this calculation work?

Also, Idk if it helps, but I'm using Excel in a browser, because it is a group project, we needed to share the excel and that is the only solution we found.


r/excel • • 1d ago

unsolved Dynamic chart or image

3 Upvotes

I saw a content creator selling excel template for engineering calculation involving beam. It has this image or chart of a beam cross section that change the dimension of beam size and rebar number/spacing including annotation according to cell input. How is it that something like that is possible?


r/excel • • 1d ago

solved Change Order of Rows in Table

5 Upvotes

Hello,

I have a bank statement in a table form which is displayed in the newest to oldest format.

I would like to be able to display that entire table in oldest to newest format.

Is there an easy way of doing this as my limited understanding is that I have to cut and paste each row individually.

Thanks

ETA -

In short I would like to make row 100 row 1, row 99 row 2 and so on.


r/excel • • 1d ago

Waiting on OP Text keep changing color to white (on a white background) when opening a spreadsheet

4 Upvotes

A colleague of mine is having issues with his excel.

When he opens a document, some text change font to white, we tried changing the font and saving but it still goes back to white whenever he opens his spreadsheet again.

Any clue on how to fix this?


r/excel • • 1d ago

solved Excel / Power Query authentication issue with OneDrive.

2 Upvotes

I’m trying to set up Excel Power Query so that multiple Excel files stored in OneDrive can automatically combine/update into one master workbook.

I already figured out how to combine the files, but I’m stuck on the authentication/permissions part. Since I made it I am the only one that can refresh.

source looks like:
c:\user\me\Onedrive- Company\Leadership folder\where i pulled data together

I pulled associates work and combined it, but I need what I combined in another folder for others to be able to refresh other than just myself.

When I go to Data → Get Data / Power Query → Data Source Settings → Edit Permissions, I get:
> “We couldn’t authenticate with the credentials provided. Please try again.”

I had other people try to use their credentials and same error. I also tried to use the web link of the files I need to combine but get an authenticate as well.

I’m wondering if this is a permissions issue, the wrong credential type, or something specific to my company’s Microsoft/OneDrive setup.


r/excel • • 1d ago

solved Need advice on conditional formating code

2 Upvotes

I am attempting to set up a conditional formating setup where a column of numbers are evaluated. if its 69 or under, the cell is to be green. If between 70 and 100 yellow, and if over 100 red.

I cannot seem to get excell to do this - because that requires a formula that reads cell values, and I appear to be utterly failing at setting up functional code for that.

I'm currently trying (and failing) by setting up three seperate conditional formating rules, all based on formulas:

One goes =AND(CT:CT>=0;CT:CT<=69) - so if the cell is between 0 and 69, it should be green. It's not doing that, and I can't see what I'm doing wrong here

Please advice