How to find a row # in a table and how to check if a result of an INDEX is blank?

helpneeded2

Board Regular
Joined
Jun 25, 2021
Messages
110
Office Version
  1. 365
Platform
  1. Windows
I am looking to learn if there are better ways to optimize my formulas. Here is the current formula I am using to obtain data from a raw data table:

Excel Formula:
=IF(INDEX(table_rawData,$A2,XMATCH(I$1,table_rawData[#Headers],0))="","",INDEX(table_rawData,$A2,XMATCH(I$1,table_rawData[#Headers],0)))

Question #1:

Currently, I am using column A for manually recording row index numbers. Rather than do this though, I was wonder if there is a better way to find out what the row number in the table is, other than using the ROW() function, with a subtraction to offset the number of rows from the top of the page, such as ROW()-2 ?

Question #2:
Is there a way to avoid typing the INDEX formula twice?
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
maybe try

Excel Formula:
=ifna(INDEX(table_rawData,$A2,XMATCH(I$1,table_rawData[#Headers],0)),"")
 
Upvote 0
Hi,

One way for your Question #2:

Excel Formula:
=IFERROR(1/(1/INDEX(table_rawData,$A2,XMATCH(I$1,table_rawData[#Headers],0))),"")

Note: Only works for numeric results.
 
Upvote 0
Another option as you have 365
Excel Formula:
=let(Return,INDEX(table_rawData,$A2,XMATCH(I$1,table_rawData[#Headers],0)) if(Return="","",Return))
 
Upvote 0
Another option as you have 365
Excel Formula:
=let(Return,INDEX(table_rawData,$A2,XMATCH(I$1,table_rawData[#Headers],0)) if(Return="","",Return))

Thank you.

For the rows, I think I have it working right now with using the new SEQUENCE function I am not too familiar with:

Excel Formula:
=IF(INDEX(table_rawData,SEQUENCE(ROWS(table_rawData[MasterPatronId])),XMATCH(C$1,table_rawData[#Headers],0))="","",INDEX(table_rawData,SEQUENCE(ROWS(table_rawData[MasterPatronId])),XMATCH(C$1,table_rawData[#Headers],0)))

I'll convert this now to the code you provided above. Thank you.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,967
Messages
6,122,503
Members
449,090
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top